class Smartdict::Core::CommandManager

Public Class Methods

run(args) click to toggle source
# File lib/smartdict/core/command_manager.rb, line 11
def self.run(args)
  first_arg = args.shift
  case first_arg
  when nil, '-h', '--help', 'help'
    run_command :help, args
  when nil, '-v', '--version', 'version'
    run_command :version, args
  else
    run_command(first_arg, args)
  end
end
run_command(name, args = []) click to toggle source
# File lib/smartdict/core/command_manager.rb, line 23
def self.run_command(name, args = [])
  if command = find(name)
    command.run(args)
  else
    abort "Unknown command: #{name}"
  end
end