Class: Thor

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

Direct Known Subclasses

Sambot::CLI, Sambot::Commands::BaseCommand

Defined Under Namespace

Modules: Shell

Class Method Summary collapse

Class Method Details

.command_help(shell, command_name) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/sambot/commands/base_command.rb', line 31

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 #{namespace} #{command_name} "
  shell.say
  shell.say
  class_options_help(shell, nil => command.options.values)
  if command.long_description
    shell.say "Description:", :green
    shell.say
    shell.print_wrapped(docs("#{namespace}/#{command_name}"), :indent => 2)
  else
    shell.say command.description
  end
  shell.say
end