choosy 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/lib/VERSION.yml +2 -2
- data/lib/choosy/super_parser.rb +7 -2
- data/spec/choosy/super_parser_spec.rb +10 -0
- metadata +3 -3
data/CHANGELOG.md
CHANGED
data/lib/VERSION.yml
CHANGED
data/lib/choosy/super_parser.rb
CHANGED
@@ -75,7 +75,8 @@ module Choosy
|
|
75
75
|
|
76
76
|
def parse_command(args, terminals)
|
77
77
|
command_name = args.shift
|
78
|
-
|
78
|
+
command_sym = command_name.to_sym
|
79
|
+
command_builder = @super_command.command_builders[command_sym]
|
79
80
|
if command_builder.nil?
|
80
81
|
if command_name =~ /^-/
|
81
82
|
raise Choosy::SuperParseError.new("unrecognized option: '#{command_name}'")
|
@@ -85,7 +86,11 @@ module Choosy
|
|
85
86
|
end
|
86
87
|
|
87
88
|
command = command_builder.entity
|
88
|
-
parser =
|
89
|
+
parser = if command_sym == :help
|
90
|
+
Parser.new(command, false, [])
|
91
|
+
else
|
92
|
+
Parser.new(command, false, terminals)
|
93
|
+
end
|
89
94
|
command_result = Choosy::ParseResult.new(command, true)
|
90
95
|
parser.parse!(args, command_result)
|
91
96
|
|
@@ -128,6 +128,16 @@ module Choosy
|
|
128
128
|
@p.command(:bar).parse!('bar', '--version')
|
129
129
|
}.should raise_error(Choosy::VersionCalled)
|
130
130
|
end
|
131
|
+
|
132
|
+
it "should call 'help' with the appropriate args when defined" do
|
133
|
+
@p.super.alter do
|
134
|
+
command :help
|
135
|
+
end
|
136
|
+
|
137
|
+
attempting {
|
138
|
+
@p.command(:bar).parse!('help', 'bar')
|
139
|
+
}.should raise_error(Choosy::HelpCalled, :bar)
|
140
|
+
end
|
131
141
|
end
|
132
142
|
end
|
133
143
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 3
|
9
|
+
version: 0.4.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Gabe McArthur
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-03-
|
17
|
+
date: 2011-03-29 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|