thunder 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/lib/thunder.rb +5 -4
- data/lib/thunder/options/optparse.rb +1 -1
- data/lib/thunder/version.rb +1 -1
- metadata +1 -1
data/CHANGELOG
CHANGED
data/lib/thunder.rb
CHANGED
@@ -23,15 +23,16 @@ module Thunder
|
|
23
23
|
return get_help(args, options)
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
parsed_options = process_options(args, command_spec)
|
27
|
+
options.merge!(parsed_options) if parsed_options
|
27
28
|
if command_spec[:subcommand]
|
28
29
|
return command_spec[:subcommand].start(args, options)
|
29
|
-
elsif
|
30
|
+
elsif parsed_options
|
30
31
|
#TODO: do arity check
|
31
|
-
return send command_spec, *args, options
|
32
|
+
return send command_spec[:name], *args, options
|
32
33
|
else
|
33
34
|
#TODO: do arity check
|
34
|
-
return send command_spec, *args
|
35
|
+
return send command_spec[:name], *args
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
@@ -5,7 +5,7 @@ module Thunder
|
|
5
5
|
class OptParseAdapter
|
6
6
|
# @see Thunder#process_options
|
7
7
|
def self.process_options(args, command_spec)
|
8
|
-
return
|
8
|
+
return {} unless command_spec[:options]
|
9
9
|
|
10
10
|
options = {}
|
11
11
|
command_spec[:options_processor] ||= OptionParser.new do |parser|
|
data/lib/thunder/version.rb
CHANGED