Class: HTTY::CLI::Commands::Help

Inherits:
HTTY::CLI::Command show all
Includes:
Display
Defined in:
lib/htty/cli/commands/help.rb

Overview

Encapsulates the help command.

Constant Summary

Constant Summary

Constants included from Display

Display::FORMATS

Instance Attribute Summary

Attributes inherited from HTTY::CLI::Command

#arguments, #session

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Display

#break, #format, #formatted_prompt_for, #indent, #logotype, #normal, #notice, #pluralize, #rescuing_from, #say, #say_goodbye, #say_header, #say_hello, #show_headers, #show_request, #show_response, #strong, #word_wrap, #word_wrap_indented

Methods inherited from HTTY::CLI::Command

#add_request_if_new, alias_for, aliases, build_for, category, command_line, complete_for?, #initialize, notify_if_cookies_cleared, raw_name, sanitize_arguments, see_also_commands

Constructor Details

This class inherits a constructor from HTTY::CLI::Command

Class Method Details

.command_line_argumentsObject

Returns the arguments for the command-line usage of the help command.



17
18
19
# File 'lib/htty/cli/commands/help.rb', line 17

def self.command_line_arguments
  '[COMMAND]'
end

.helpObject

Returns the help text for the help command.



22
23
24
# File 'lib/htty/cli/commands/help.rb', line 22

def self.help
  'Displays this help table, or help on the specified command'
end

.help_extendedObject

Returns the extended help text for the help command.



27
28
29
30
# File 'lib/htty/cli/commands/help.rb', line 27

def self.help_extended
  'Displays a table containing available commands and a brief description ' +
  'of each, or detailed help on the specified command.'
end

Instance Method Details

#performObject

Performs the help command.



33
34
35
36
37
38
39
40
41
42
# File 'lib/htty/cli/commands/help.rb', line 33

def perform
  return display_help if arguments.empty?

  unless arguments.length == 1
    raise ArgumentError,
          "wrong number of arguments (#{arguments.length} for 1)"
  end

  display_help_for arguments.first
end