@@ -35,13 +35,13 @@ class Command
35
35
# @yieldparam [Array<Option>] run_options an Array of
36
36
# Option instances defined from the above +options+
37
37
#
38
- def initialize ( name , registry : nil , ** options , &block )
38
+ def initialize ( name , options = { } , &block )
39
39
@name = name
40
40
@description = options [ :description ]
41
41
@summary = options [ :summary ]
42
42
@block = block_given? ? block : proc { }
43
- @registry = registry || GitCommander ::Registry . new
44
- @output = options [ :output ] || STDOUT
43
+ @registry = options [ : registry] || GitCommander ::Registry . new
44
+ @output = options [ :output ] || $stdout
45
45
46
46
define_command_options ( options )
47
47
end
@@ -52,7 +52,7 @@ def initialize(name, registry: nil, **options, &block)
52
52
#
53
53
def run ( run_options = [ ] )
54
54
assign_option_values ( run_options )
55
- Runner . new ( self ) . run options . map ( &:to_h ) . reduce ( :merge )
55
+ Runner . new ( self ) . run ( options . map ( &:to_h ) . reduce ( :merge ) || { } )
56
56
end
57
57
58
58
# Appends the +message+ to the Command's {#output}
@@ -107,10 +107,10 @@ def add_option(option_type, options = {})
107
107
108
108
private
109
109
110
- def define_command_options ( options )
111
- @arguments = options_from_hash ( options [ :arguments ] )
112
- @flags = options_from_hash ( options [ :flags ] )
113
- @switches = options_from_hash ( options [ :switches ] )
110
+ def define_command_options ( new_options )
111
+ @arguments = options_from_hash ( new_options [ :arguments ] )
112
+ @flags = options_from_hash ( new_options [ :flags ] )
113
+ @switches = options_from_hash ( new_options [ :switches ] )
114
114
end
115
115
116
116
def options_from_hash ( hash )
0 commit comments