arg-parser 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/arg-parser/definition.rb +2 -2
- data/lib/arg-parser/dsl.rb +1 -1
- data/lib/arg-parser/parser.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODcwNmFlYTFmYzRkMDE2NzRkYzVjMmIyZjEzOGZiMDZmNWYxODRjNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzNlZjg3MmI1YTVkNjY1NmNmOThhYWIyM2I3YjJmMzgzZDgzMTViZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmY0MThmOTJiM2UwNmVlODEwZWFkNjczNWZlNmYwNzA4NThkNGMwOGNkYTdj
|
10
|
+
OWNlY2ZlZGVlYzMwNTNhMDM2OTJhM2RmNDIzOTFhZmVmNzdhOTBiZmY4M2Qw
|
11
|
+
N2I5YjdiNjhhNDdlYWI4ZjJiNTNmYzM3YjM1ZDJiZTYzMGM3NWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWNlNThjZGRiZGM3YjY4ZGQ2N2FkODFiN2E4YzMyMGRkNDY2MDhmMzRkNGJl
|
14
|
+
NTNkMzZkMzU0Y2ZkN2VkMmM3YjBhMWU5MDI0ZDE1YTBiN2JiNzIzYzQ1MmYz
|
15
|
+
MDhmYTk0NjYwMzI4ODU4MWY4NDU0ODJlMDgxMzZmZTU3YjE5NWY=
|
@@ -57,7 +57,7 @@ module ArgParser
|
|
57
57
|
if arg.short_key && @short_keys[arg.short_key]
|
58
58
|
raise ArgumentError, "An argument with short key '#{arg.short_key}' has already been defined"
|
59
59
|
end
|
60
|
-
if rest_args
|
60
|
+
if arg.is_a?(RestArgument) && rest_args
|
61
61
|
raise ArgumentError, "Only one rest argument can be defined"
|
62
62
|
end
|
63
63
|
@arguments[arg.key] = arg
|
@@ -175,7 +175,7 @@ module ArgParser
|
|
175
175
|
errors = []
|
176
176
|
@require_set.each do |req, sets|
|
177
177
|
sets.each do |set|
|
178
|
-
count = set.count{ |arg| args.has_key?(arg.key) }
|
178
|
+
count = set.count{ |arg| args.has_key?(arg.key) && args[arg.key] }
|
179
179
|
case req
|
180
180
|
when :one
|
181
181
|
if count == 0
|
data/lib/arg-parser/dsl.rb
CHANGED
data/lib/arg-parser/parser.rb
CHANGED
@@ -165,6 +165,8 @@ module ArgParser
|
|
165
165
|
self.errors.concat(@definition.validate_requirements(result))
|
166
166
|
if self.errors.size > 0
|
167
167
|
@show_usage = true
|
168
|
+
elsif result.empty?
|
169
|
+
BasicObject.new
|
168
170
|
else
|
169
171
|
props = result.keys
|
170
172
|
@definition.args.each{ |arg| props << arg.key unless result.has_key?(arg.key) }
|