Class: HTTY::CLI::Commands::Cookies
- Inherits:
-
HTTY::CLI::Command
- Object
- HTTY::CLI::Command
- HTTY::CLI::Commands::Cookies
- Includes:
- Display
- Defined in:
- lib/htty/cli/commands/cookies.rb
Overview
Encapsulates the cookies command.
Constant Summary
Constants included from Display
Instance Attribute Summary
Attributes inherited from HTTY::CLI::Command
Class Method Summary collapse
-
.category ⇒ Object
Returns the name of a category under which help for the cookies command should appear.
-
.help ⇒ Object
Returns the help text for the cookies command.
-
.help_extended ⇒ Object
Returns the extended help text for the cookies command.
-
.see_also_commands ⇒ Object
Returns related command classes for the cookies command.
Instance Method Summary collapse
-
#perform ⇒ Object
Performs the cookies command.
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, command_line, command_line_arguments, complete_for?, #initialize, notify_if_cookies_cleared, raw_name, sanitize_arguments
Constructor Details
This class inherits a constructor from HTTY::CLI::Command
Class Method Details
.category ⇒ Object
Returns the name of a category under which help for the cookies command should appear.
10 11 12 |
# File 'lib/htty/cli/commands/cookies.rb', line 10 def self.category 'Building Requests' end |
.help ⇒ Object
Returns the help text for the cookies command.
15 16 17 |
# File 'lib/htty/cli/commands/cookies.rb', line 15 def self.help 'Displays the cookies of the request' end |
.help_extended ⇒ Object
Returns the extended help text for the cookies command.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/htty/cli/commands/cookies.rb', line 20 def self.help_extended 'Displays the cookies used for the request. Does not communicate with ' + "the host.\n" + "\n" + "This command displays cookies extracted from the request's " + "'#{HTTY::Request::COOKIES_HEADER_NAME}' header, which is nevertheless " + 'shown when you type ' + "#{strong HTTY::CLI::Commands::HeadersRequest.command_line}.\n" + "\n" + 'Cookies are not required to have unique names. You can add multiple ' + 'cookies with the same name, and they will be removed in ' + "last-in-first-out order.\n" + "\n" + 'Cookies are cleared automatically when you change hosts.' end |
.see_also_commands ⇒ Object
Returns related command classes for the cookies command.
37 38 39 40 41 42 43 44 |
# File 'lib/htty/cli/commands/cookies.rb', line 37 def self.see_also_commands [HTTY::CLI::Commands::CookiesAdd, HTTY::CLI::Commands::CookiesRemove, HTTY::CLI::Commands::CookiesRemoveAll, HTTY::CLI::Commands::CookiesUse, HTTY::CLI::Commands::HeadersRequest, HTTY::CLI::Commands::HeadersResponse] end |
Instance Method Details
#perform ⇒ Object
Performs the cookies command.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/htty/cli/commands/cookies.rb', line 47 def perform = session.requests.last. margin = .inject 0 do |result, | [.first.length, result].max end .each do |name, value| puts "#{name.rjust margin}: #{value}" end self end |