class Cmdlib::Command
Class for create command object.
Attributes
argnum[RW]
Mandatory argument numbers for command.
brief[RW]
Contain object with describe text.
details[RW]
Contain object with describe text.
example[RW]
Contain object with describe text.
name[RW]
Contain object with describe text.
options[RW]
List with options for command and subcommand.
subcmd[RW]
List with options for command and subcommand.
Public Class Methods
new()
click to toggle source
# File lib/cmdlib/command.rb, line 14 def initialize @name = '' @brief = '' @details = [] @example = [] @options = {} @subcmd = [] @argnum = 0 end
Public Instance Methods
addcmd( cmd )
click to toggle source
# File lib/cmdlib/command.rb, line 38 def addcmd ( cmd ) raise TypeError, 'Incorrectly types for command object.' unless cmd.is_a? Cmdlib::Command @subcmd << cmd end
addopt( opt )
click to toggle source
# File lib/cmdlib/command.rb, line 31 def addopt ( opt ) raise TypeError, 'Incorrectly types for option object.' unless opt.instance_of? Cmdlib::Option @options[opt.longname.to_sym] = opt end
handler( global_options, args )
click to toggle source
# File lib/cmdlib/command.rb, line 27 def handler( global_options, args ) puts "error: handler do not set for this command." end
init()
click to toggle source
# File lib/cmdlib/command.rb, line 24 def init end