Class: Thor

Inherits:
Object
  • Object
show all
Defined in:
lib/cinch/bot_template/main/thor.rb

Defined Under Namespace

Modules: Base, Shell

Class Method Summary collapse

Class Method Details

.command_help(shell, command_name) ⇒ Object Also known as: task_help



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cinch/bot_template/main/thor.rb', line 4

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 "USAGE ", ['white', :bold]
  shell.say "\b:"
  shell.say "  #{banner(command)}"
  class_options_help(shell, nil => command.options.values)
  if command.long_description
    shell.say "DESCRIPTION ", ['white', :bold]
    shell.say "\b:"
    shell.print_wrapped(command.long_description)
  else
    shell.say command.description
  end
end