Method: Thor.command_help

Defined in:
lib/thor.rb

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

Prints help information for the given command.

Parameters

shell<Thor::Shell> command_name<String>



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/thor.rb', line 258

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:"
  shell.say "  #{banner(command).split("\n").join("\n  ")}"
  shell.say
  class_options_help(shell, nil => command.options.values)
  print_exclusive_options(shell, command)
  print_at_least_one_required_options(shell, command)

  if command.long_description
    shell.say "Description:"
    if command.wrap_long_description
      shell.print_wrapped(command.long_description, indent: 2)
    else
      shell.say command.long_description
    end
  else
    shell.say command.description
  end
end