clive 0.3.0 → 0.3.1
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/VERSION +1 -1
- data/clive.gemspec +1 -1
- data/lib/clive/command.rb +5 -11
- data/test/bin_test +1 -1
- data/test/test_clive.rb +15 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/clive.gemspec
CHANGED
data/lib/clive/command.rb
CHANGED
@@ -169,17 +169,11 @@ class Clive
|
|
169
169
|
r << [:flag, flag]
|
170
170
|
else
|
171
171
|
if k == :word
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
else
|
178
|
-
r.last[2] = v
|
179
|
-
end
|
180
|
-
else
|
181
|
-
r << [:argument, v]
|
182
|
-
end
|
172
|
+
# add to last flag?
|
173
|
+
if r.last && r.last[0] == :flag && r.last[2].nil?
|
174
|
+
r.last[2] = v
|
175
|
+
else
|
176
|
+
r << [:argument, v]
|
183
177
|
end
|
184
178
|
else
|
185
179
|
raise InvalidOption.new(v)
|
data/test/bin_test
CHANGED
data/test/test_clive.rb
CHANGED
@@ -147,6 +147,21 @@ class TestClive < Test::Unit::TestCase
|
|
147
147
|
assert_equal r, opts
|
148
148
|
end
|
149
149
|
|
150
|
+
should "recognise an argument" do
|
151
|
+
c = Clive.new do
|
152
|
+
bool(:v, :verbose, "Run verbosely") {}
|
153
|
+
end
|
154
|
+
args = c.parse ["argument"]
|
155
|
+
assert_equal ["argument"], args
|
156
|
+
end
|
157
|
+
|
158
|
+
should "recognise multiple arguments" do
|
159
|
+
c = Clive.new do
|
160
|
+
bool(:v, :verbose, "Run verbosely") {}
|
161
|
+
end
|
162
|
+
args = c.parse ["argument", "and", "another"]
|
163
|
+
assert_equal ["argument", "and", "another"], args
|
164
|
+
end
|
150
165
|
|
151
166
|
should "parse a mixture properly" do
|
152
167
|
opts = {}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joshua Hawxwell
|