slop 3.0.3 → 3.0.4
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.
- data/CHANGES.md +5 -0
- data/lib/slop.rb +4 -4
- data/slop.gemspec +1 -1
- data/test/slop_test.rb +7 -0
- metadata +2 -2
data/CHANGES.md
CHANGED
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.0.
|
7
|
+
VERSION = '3.0.4'
|
8
8
|
|
9
9
|
# The main Error class, all Exception classes inherit from this class.
|
10
10
|
class Error < StandardError; end
|
@@ -411,12 +411,12 @@ class Slop
|
|
411
411
|
raise MissingArgumentError, "#{option.key} expects an argument"
|
412
412
|
end
|
413
413
|
|
414
|
-
execute_option(option, argument, index)
|
414
|
+
execute_option(option, argument, index, item)
|
415
415
|
elsif option.accepts_optional_argument?
|
416
416
|
argument ||= items.at(index + 1)
|
417
417
|
|
418
418
|
if argument && argument !~ /\A--?/
|
419
|
-
execute_option(option, argument, index)
|
419
|
+
execute_option(option, argument, index, item)
|
420
420
|
else
|
421
421
|
option.call(nil)
|
422
422
|
end
|
@@ -447,7 +447,7 @@ class Slop
|
|
447
447
|
return
|
448
448
|
end
|
449
449
|
|
450
|
-
@trash << index + 1
|
450
|
+
@trash << index + 1 unless item && item.end_with?("=#{argument}")
|
451
451
|
option.value = argument
|
452
452
|
|
453
453
|
if option.match? && !argument.match(option.config[:match])
|
data/slop.gemspec
CHANGED
data/test/slop_test.rb
CHANGED
@@ -297,4 +297,11 @@ class SlopTest < TestCase
|
|
297
297
|
end
|
298
298
|
end
|
299
299
|
|
300
|
+
test "option=value syntax does NOT consume following argument" do
|
301
|
+
opts = Slop.new { on :foo=; on 'bar=?' }
|
302
|
+
args = %w' --foo=bar baz --bar=zing hello '
|
303
|
+
opts.parse!(args)
|
304
|
+
assert_equal %w' baz hello ', args
|
305
|
+
end
|
306
|
+
|
300
307
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-31 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A simple DSL for gathering options and parsing the command line
|
15
15
|
email: lee@jarvis.co
|