module ZabconCommand
Base module for instantiating Zabcon commands.
Public Class Methods
add_command(path, &block)
click to toggle source
Method used to add commands to the Zabcon command processor path is the command path such as “get host group” A block must also be passed, this block will be executed against the
Command object to to define the command and then inserted into the global CommandList singleton.
# File libs/command_tree.rb, line 658 def self.add_command (path, &block) path= if path.class==Array path elsif path.class==String path.split2(:trim_empty=>true) else raise "Path must be Array or string" end cmd=Command.new(path) cmd.instance_eval(&block) raise "Help tag required for \"#{path.join(" ")}\", and must be of type symbol. Use the symbol :none for no help" if cmd.help_tag.class!=Symbol CommandList.instance.insert(path,cmd) end