ArgvParser 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/argv_parser.rb +4 -4
- metadata +2 -2
data/lib/argv_parser.rb
CHANGED
@@ -14,7 +14,7 @@ class ArgvParser
|
|
14
14
|
:long => long,
|
15
15
|
:type => type,
|
16
16
|
:opts => options,
|
17
|
-
:yield => Proc.new {|v| yield(v) }
|
17
|
+
:yield => Proc.new {|p, v| yield(p, v) }
|
18
18
|
}
|
19
19
|
@l_short = short.length + 1 if @l_short < short.length + 1
|
20
20
|
@l_long = long.length + 1 if @l_long < long.length + 1
|
@@ -44,7 +44,7 @@ class ArgvParser
|
|
44
44
|
while i < args.length
|
45
45
|
if v = @args[args[i].downcase]
|
46
46
|
@mandatory.delete args[i].downcase
|
47
|
-
|
47
|
+
|
48
48
|
n = nil
|
49
49
|
if v[:type]
|
50
50
|
raise ArgumentError.new("argument for #{args[i].downcase} missing") if i+1 >= args.length
|
@@ -70,12 +70,12 @@ class ArgvParser
|
|
70
70
|
if not @mandatory.empty?
|
71
71
|
raise ArgumentError.new("mandatory #{@mandatory[0]} is missing")
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
if executor.empty?
|
75
75
|
help
|
76
76
|
else
|
77
77
|
executor.each do |e|
|
78
|
-
e[0].call(e[1])
|
78
|
+
e[0].call(self, e[1])
|
79
79
|
end
|
80
80
|
end
|
81
81
|
rescue Exception => e
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ArgvParser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
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: 2013-
|
12
|
+
date: 2013-04-17 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|