slop 3.3.0 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.md +5 -0
- data/lib/slop.rb +9 -5
- data/slop.gemspec +1 -1
- data/test/slop_test.rb +6 -0
- metadata +8 -8
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.3.
|
7
|
+
VERSION = '3.3.1'
|
8
8
|
|
9
9
|
# The main Error class, all Exception classes inherit from this class.
|
10
10
|
class Error < StandardError; end
|
@@ -466,8 +466,12 @@ class Slop
|
|
466
466
|
return
|
467
467
|
end
|
468
468
|
|
469
|
-
|
470
|
-
|
469
|
+
if argument
|
470
|
+
@trash << index + 1 unless item && item.end_with?("=#{argument}")
|
471
|
+
option.value = argument
|
472
|
+
else
|
473
|
+
option.value = option.count > 0
|
474
|
+
end
|
471
475
|
|
472
476
|
if option.match? && !argument.match(option.config[:match])
|
473
477
|
raise InvalidArgumentError, "#{argument} is an invalid argument"
|
@@ -485,11 +489,11 @@ class Slop
|
|
485
489
|
#
|
486
490
|
# Returns nothing.
|
487
491
|
def execute_multiple_switches(option, argument, index)
|
488
|
-
execute_option(option,
|
492
|
+
execute_option(option, nil, index)
|
489
493
|
argument.split('').each do |key|
|
490
494
|
opt = fetch_option(key)
|
491
495
|
opt.count += 1
|
492
|
-
execute_option(opt,
|
496
|
+
execute_option(opt, nil, index, key)
|
493
497
|
end
|
494
498
|
end
|
495
499
|
|
data/slop.gemspec
CHANGED
data/test/slop_test.rb
CHANGED
@@ -218,6 +218,12 @@ class SlopTest < TestCase
|
|
218
218
|
assert_equal 'abc123', opts[:f]
|
219
219
|
end
|
220
220
|
|
221
|
+
test "muiltiple_switches should not trash arguments" do
|
222
|
+
opts = Slop.new{ on :f; on :b }
|
223
|
+
args = opts.parse!(%w'-fb foo')
|
224
|
+
assert_equal %w'foo', args
|
225
|
+
end
|
226
|
+
|
221
227
|
test "setting/getting the banner" do
|
222
228
|
opts = Slop.new :banner => 'foo'
|
223
229
|
assert_equal 'foo', opts.banner
|
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.3.
|
4
|
+
version: 3.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70351938520120 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70351938520120
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: minitest
|
27
|
-
requirement: &
|
27
|
+
requirement: &70351938541500 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70351938541500
|
36
36
|
description: A simple DSL for gathering options and parsing the command line
|
37
37
|
email: lee@jarvis.co
|
38
38
|
executables: []
|
@@ -68,7 +68,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
68
|
version: '0'
|
69
69
|
segments:
|
70
70
|
- 0
|
71
|
-
hash:
|
71
|
+
hash: 4605818326398820360
|
72
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
version: '0'
|
78
78
|
segments:
|
79
79
|
- 0
|
80
|
-
hash:
|
80
|
+
hash: 4605818326398820360
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
83
|
rubygems_version: 1.8.11
|