Class: Choosy::SuperCommand
Instance Attribute Summary collapse
Attributes inherited from BaseCommand
#builder, #listing, #name, #option_builders, #printer, #summary
Instance Method Summary
collapse
Methods inherited from BaseCommand
#alter, #initialize, #options, #parse!
Instance Attribute Details
Returns the value of attribute metaname.
9
10
11
|
# File 'lib/choosy/super_command.rb', line 9
def metaname
@metaname
end
|
Instance Method Details
#command_builders ⇒ Object
11
12
13
|
# File 'lib/choosy/super_command.rb', line 11
def command_builders
@command_builders ||= {}
end
|
#commands ⇒ Object
15
16
17
|
# File 'lib/choosy/super_command.rb', line 15
def commands
@command_builders.values.map {|b| b.command }
end
|
#execute!(args) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/choosy/super_command.rb', line 27
def execute!(args)
super_result = parse!(args)
super_result.subresults.each do |result|
cmd = result.command
if cmd.executor.nil?
raise Choosy::ConfigurationError.new("No executor given for: #{cmd.name}")
end
end
super_result.subresults.each do |result|
executor = result.command.executor
if executor.is_a?(Proc)
executor.call(result.args, result.options)
else
executor.execute!(result.args, result.options)
end
end
end
|
#parsimonious=(value) ⇒ Object
19
20
21
|
# File 'lib/choosy/super_command.rb', line 19
def parsimonious=(value)
@parsimonious = value
end
|
#parsimonious? ⇒ Boolean
23
24
25
|
# File 'lib/choosy/super_command.rb', line 23
def parsimonious?
@parsimonious ||= false
end
|