class Smith::CommandBase
Attributes
options[R]
target[R]
Public Class Methods
new()
click to toggle source
# File lib/smith/command_base.rb, line 12 def initialize @parser = Trollop::Parser.new options_spec end
Public Instance Methods
format_help(opts={})
click to toggle source
# File lib/smith/command_base.rb, line 22 def format_help(opts={}) StringIO.new.tap do |help| help.puts opts[:prefix] if opts[:prefix] @parser.educate(help) help.rewind end.read end
parse_options(args)
click to toggle source
# File lib/smith/command_base.rb, line 17 def parse_options(args) @options = @parser.parse(args) @target = args end
Protected Instance Methods
conflicts(*syms)
click to toggle source
# File lib/smith/command_base.rb, line 45 def conflicts(*syms) @parser.conflicts(*syms) end
depends(*syms)
click to toggle source
# File lib/smith/command_base.rb, line 49 def depends(*syms) @parser.depends(*syms) end
opt(*opt_spec)
click to toggle source
# File lib/smith/command_base.rb, line 41 def opt(*opt_spec) @parser.opt(*opt_spec) end
options_spec()
click to toggle source
# File lib/smith/command_base.rb, line 53 def options_spec banner "You should really set a proper banner notice for this command." end