class Thor
Public Class Methods
command_help(shell, command_name)
click to toggle source
Prints help information for the given command.
Parameters¶ ↑
shell<Thor::Shell> command_name<String>
# File lib/thor/rich_options/thor.rb, line 19 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)}" shell.say class_options_help(shell, nil => command.options.map { |_, o| o }) print_exclusive_options(shell, command) print_at_least_one_required_options(shell, command) if command.long_description shell.say "Description:" shell.print_wrapped(command.long_description, :indent => 2) else shell.say command.description end end
help(shell, subcommand = false)
click to toggle source
Prints help information for this class.
Parameters¶ ↑
shell<Thor::Shell>
# File lib/thor/rich_options/thor.rb, line 43 def help(shell, subcommand = false) list = printable_commands(true, subcommand) Thor::Util.thor_classes_in(self).each do |klass| list += klass.printable_commands(false) end list.sort! { |a, b| a[0] <=> b[0] } if defined?(@package_name) && @package_name shell.say "#{@package_name} commands:" else shell.say "Commands:" end shell.print_table(list, :indent => 2, :truncate => true) shell.say class_options_help(shell) print_exclusive_options(shell) print_at_least_one_required_options(shell) end