slop 3.4.6 → 3.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -0
- data/README.md +3 -3
- data/lib/slop.rb +5 -1
- data/lib/slop/commands.rb +1 -1
- data/slop.gemspec +2 -2
- data/test/slop_test.rb +10 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1c164d9832f305170e0d6711b2ce1aa185098ce
|
4
|
+
data.tar.gz: 1e827ece3bd97ff1fb20379bc85f4ae52efbe7b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35734081fcec45d6d65abf0546c8de9e8921d5c226b23f8e7306159e87112ca9f6d3afbe20dfc5f9a515cea023caee86f42221f76f66cbe9d2b0523dd45899d7
|
7
|
+
data.tar.gz: 677373ed7eee79341843dd52a674b64d17f8644afa6d0799f4f74fecb5603d0b3925fbaba8a616cb15a4be0e00b01e473d52d94d8d5e2a22cd9cdfdbe90e3c7e
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -2,9 +2,9 @@ Slop
|
|
2
2
|
====
|
3
3
|
|
4
4
|
Slop is a simple option parser with an easy to remember syntax and friendly API.
|
5
|
-
API Documentation is available [here](http://
|
5
|
+
API Documentation is available [here](http://leejarvis.github.com/rdoc/slop/).
|
6
6
|
|
7
|
-
[](http://travis-ci.org/leejarvis/slop)
|
8
8
|
|
9
9
|
Usage
|
10
10
|
-----
|
@@ -123,7 +123,7 @@ opts = Slop.parse do
|
|
123
123
|
|
124
124
|
command 'add' do
|
125
125
|
on :v, :verbose, 'Enable verbose mode'
|
126
|
-
on :name
|
126
|
+
on :name=, 'Your name'
|
127
127
|
|
128
128
|
run do |opts, args|
|
129
129
|
puts "You ran 'add' with options #{opts.to_hash} and args: #{args.inspect}"
|
data/lib/slop.rb
CHANGED
@@ -4,7 +4,7 @@ require 'slop/commands'
|
|
4
4
|
class Slop
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
VERSION = '3.4.
|
7
|
+
VERSION = '3.4.7'
|
8
8
|
|
9
9
|
# The main Error class, all Exception classes inherit from this class.
|
10
10
|
class Error < StandardError; end
|
@@ -226,6 +226,10 @@ class Slop
|
|
226
226
|
return items
|
227
227
|
end
|
228
228
|
|
229
|
+
# reset the trash so it doesn't carry over if you parse multiple
|
230
|
+
# times with the same instance
|
231
|
+
@trash.clear
|
232
|
+
|
229
233
|
if cmd = @commands[items[0]]
|
230
234
|
items.shift
|
231
235
|
return cmd.parse! items
|
data/lib/slop/commands.rb
CHANGED
@@ -40,7 +40,7 @@ class Slop
|
|
40
40
|
@triggered_command = nil
|
41
41
|
|
42
42
|
warn "[DEPRECATED] Slop::Commands is deprecated and will be removed in "\
|
43
|
-
"Slop version 4. Check out http://
|
43
|
+
"Slop version 4. Check out http://leejarvis.github.io/slop/#commands for "\
|
44
44
|
"a new implementation of commands."
|
45
45
|
|
46
46
|
if block_given?
|
data/slop.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'slop'
|
3
|
-
s.version = '3.4.
|
3
|
+
s.version = '3.4.7'
|
4
4
|
s.summary = 'Simple Lightweight Option Parsing'
|
5
5
|
s.description = 'A simple DSL for gathering options and parsing the command line'
|
6
6
|
s.author = 'Lee Jarvis'
|
7
7
|
s.email = 'ljjarvis@gmail.com'
|
8
|
-
s.homepage = 'http://github.com/
|
8
|
+
s.homepage = 'http://github.com/leejarvis/slop'
|
9
9
|
s.files = `git ls-files`.split("\n")
|
10
10
|
s.test_files = `git ls-files -- test/*`.split("\n")
|
11
11
|
s.license = 'MIT'
|
data/test/slop_test.rb
CHANGED
@@ -505,4 +505,14 @@ class SlopTest < TestCase
|
|
505
505
|
assert_equal 'second', i
|
506
506
|
end
|
507
507
|
|
508
|
+
test "taking out the trash" do
|
509
|
+
args = []
|
510
|
+
opts = Slop.new { on :f, :foo }
|
511
|
+
opts.run { |_, a| args = a }
|
512
|
+
opts.parse! %w(--foo bar)
|
513
|
+
assert_equal %w(bar), args
|
514
|
+
opts.parse! %w(foo)
|
515
|
+
assert_equal %w(foo), args
|
516
|
+
end
|
517
|
+
|
508
518
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Jarvis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -59,7 +59,7 @@ files:
|
|
59
59
|
- test/helper.rb
|
60
60
|
- test/option_test.rb
|
61
61
|
- test/slop_test.rb
|
62
|
-
homepage: http://github.com/
|
62
|
+
homepage: http://github.com/leejarvis/slop
|
63
63
|
licenses:
|
64
64
|
- MIT
|
65
65
|
metadata: {}
|