Class: Thor

Inherits:
Object
  • Object
show all
Defined in:
lib/sambot/base_command.rb,
lib/sambot/base_command.rb,
lib/sambot/base_command.rb

Direct Known Subclasses

Sambot::BaseCommand

Defined Under Namespace

Modules: Shell

Class Method Summary collapse

Class Method Details

.command_help(shell, command_name) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/sambot/base_command.rb', line 39

def command_help(shell, command_name)
  meth = normalize_command_name(command_name)
  command = all_commands[meth]
  handle_no_command_error(meth) unless command
  shell.say
  shell.say('  Usage:', :green)
  shell.say
  shell.say "  sambot #{command_name} "
  shell.say
  shell.say
  class_options_help(shell, nil => command.options.values)
  shell.say '  Description:', :green
  shell.say
  shell.print_wrapped(docs(command_name.to_s), indent: 2)
  shell.say
end