Module: OptparseLite::ServiceObject
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from HelpHelper
#cmd, #hdr, #help_requested?, #looks_like_header?, #prefix, #txt
Instance Attribute Details
#ui=(value) ⇒ Object
594
595
596
|
# File 'lib/optparse-lite.rb', line 594
def ui=(value)
@ui = value
end
|
Instance Method Details
#init_service_object(spec, ui) ⇒ Object
577
578
579
580
581
|
# File 'lib/optparse-lite.rb', line 577
def init_service_object spec, ui
@spec = spec
@ui = ui
@dispatcher = Dispatcher.new(self, @spec, @ui)
end
|
#run(argv) ⇒ Object
582
583
584
|
# File 'lib/optparse-lite.rb', line 582
def run argv
@dispatcher.run argv
end
|
#subcommand_dispatch(*a) ⇒ Object
585
586
587
588
589
590
591
592
593
|
# File 'lib/optparse-lite.rb', line 585
def subcommand_dispatch(*a)
cmd = @spec.get_command(caller.first.match(/`([^']+)'\Z/)[1])
if a.empty? || (help_requested?(a) && a.shift)
return @dispatcher.help.command_help_full(cmd.pretty_full, a)
end
if cmd = @dispatcher.help.find_one_loudly(a.shift, cmd.subcommands)
cmd.run @dispatcher, a
end
end
|