Module: Scripting::Commands::InstanceMethods

Defined in:
lib/scripting/commands.rb

Instance Method Summary collapse

Instance Method Details

#command(name, &blk) ⇒ Object



58
59
60
# File 'lib/scripting/commands.rb', line 58

def command name, &blk
  options.commands[name] = Command.new(self, name).describe(&blk)
end

#run_command!(name, *args) ⇒ Object



62
63
64
65
66
67
68
69
70
71
# File 'lib/scripting/commands.rb', line 62

def run_command! name, *args
  command = options.commands[name]
  if command.nil?
    help!
    $stderr.puts "\n\nCommand: #{name} is not known"
    exit
  end

  command.run! *args
end