Module: HTTY::CLI::Commands

Extended by:
Enumerable
Defined in:
lib/htty/cli/commands.rb,
lib/htty/cli/commands/cd.rb,
lib/htty/cli/commands/put.rb,
lib/htty/cli/commands/get.rb,
lib/htty/cli/commands/post.rb,
lib/htty/cli/commands/help.rb,
lib/htty/cli/commands/exit.rb,
lib/htty/cli/commands/undo.rb,
lib/htty/cli/commands/quit.rb,
lib/htty/cli/commands/form.rb,
lib/htty/cli/commands/patch.rb,
lib/htty/cli/commands/reuse.rb,
lib/htty/cli/commands/status.rb,
lib/htty/cli/commands/follow.rb,
lib/htty/cli/commands/delete.rb,
lib/htty/cli/commands/history.rb,
lib/htty/cli/commands/address.rb,
lib/htty/cli/commands/cookies.rb,
lib/htty/cli/commands/form_add.rb,
lib/htty/cli/commands/http_put.rb,
lib/htty/cli/commands/path_set.rb,
lib/htty/cli/commands/host_set.rb,
lib/htty/cli/commands/http_get.rb,
lib/htty/cli/commands/body_set.rb,
lib/htty/cli/commands/port_set.rb,
lib/htty/cli/commands/http_head.rb,
lib/htty/cli/commands/body_edit.rb,
lib/htty/cli/commands/query_set.rb,
lib/htty/cli/commands/http_post.rb,
lib/htty/cli/commands/query_add.rb,
lib/htty/cli/commands/header_set.rb,
lib/htty/cli/commands/body_unset.rb,
lib/htty/cli/commands/cookie_add.rb,
lib/htty/cli/commands/http_trace.rb,
lib/htty/cli/commands/scheme_set.rb,
lib/htty/cli/commands/http_patch.rb,
lib/htty/cli/commands/body_clear.rb,
lib/htty/cli/commands/form_clear.rb,
lib/htty/cli/commands/headers_set.rb,
lib/htty/cli/commands/http_delete.rb,
lib/htty/cli/commands/query_unset.rb,
lib/htty/cli/commands/form_remove.rb,
lib/htty/cli/commands/cookies_add.rb,
lib/htty/cli/commands/cookies_use.rb,
lib/htty/cli/commands/query_clear.rb,
lib/htty/cli/commands/userinfo_set.rb,
lib/htty/cli/commands/query_remove.rb,
lib/htty/cli/commands/http_options.rb,
lib/htty/cli/commands/fragment_set.rb,
lib/htty/cli/commands/header_unset.rb,
lib/htty/cli/commands/body_request.rb,
lib/htty/cli/commands/headers_unset.rb,
lib/htty/cli/commands/cookie_remove.rb,
lib/htty/cli/commands/cookies_clear.rb,
lib/htty/cli/commands/body_response.rb,
lib/htty/cli/commands/headers_clear.rb,
lib/htty/cli/commands/userinfo_unset.rb,
lib/htty/cli/commands/userinfo_clear.rb,
lib/htty/cli/commands/cookies_remove.rb,
lib/htty/cli/commands/fragment_unset.rb,
lib/htty/cli/commands/fragment_clear.rb,
lib/htty/cli/commands/query_unset_all.rb,
lib/htty/cli/commands/form_remove_all.rb,
lib/htty/cli/commands/headers_request.rb,
lib/htty/cli/commands/history_verbose.rb,
lib/htty/cli/commands/headers_response.rb,
lib/htty/cli/commands/ssl_verification.rb,
lib/htty/cli/commands/headers_unset_all.rb,
lib/htty/cli/commands/body_request_open.rb,
lib/htty/cli/commands/cookies_remove_all.rb,
lib/htty/cli/commands/body_response_open.rb,
lib/htty/cli/commands/ssl_verification_on.rb,
lib/htty/cli/commands/ssl_verification_off.rb

Overview

Contains classes that implement commands in the user interface.

Defined Under Namespace

Classes: Address, BodyClear, BodyEdit, BodyRequest, BodyRequestOpen, BodyResponse, BodyResponseOpen, BodySet, BodyUnset, Cd, CookieAdd, CookieRemove, Cookies, CookiesAdd, CookiesClear, CookiesRemove, CookiesRemoveAll, CookiesUse, Delete, Exit, Follow, Form, FormAdd, FormClear, FormRemove, FormRemoveAll, FragmentClear, FragmentSet, FragmentUnset, Get, HeaderSet, HeaderUnset, HeadersClear, HeadersRequest, HeadersResponse, HeadersSet, HeadersUnset, HeadersUnsetAll, Help, History, HistoryVerbose, HostSet, HttpDelete, HttpGet, HttpHead, HttpOptions, HttpPatch, HttpPost, HttpPut, HttpTrace, Patch, PathSet, PortSet, Post, Put, QueryAdd, QueryClear, QueryRemove, QuerySet, QueryUnset, QueryUnsetAll, Quit, Reuse, SchemeSet, SslVerification, SslVerificationOff, SslVerificationOn, Status, Undo, UserinfoClear, UserinfoSet, UserinfoUnset

Class Method Summary collapse

Class Method Details

.build_for(command_line, attributes = {}) ⇒ Object

Returns a HTTY::CLI::Command descendant whose command line representation matches the specified command_line. If an attributes hash is specified, it is used to initialize the command.



13
14
15
16
17
18
19
20
# File 'lib/htty/cli/commands.rb', line 13

def self.build_for(command_line, attributes={})
  each do |klass|
    if (command = klass.build_for(command_line, attributes))
      return command
    end
  end
  nil
end

.eachObject

Yields each HTTY::CLI::Command descendant in turn.



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/htty/cli/commands.rb', line 23

def self.each
  Dir.glob "#{File.dirname __FILE__}/commands/*.rb" do |f|
    class_name = File.basename(f, '.rb').gsub(/^(.)/) do |initial|
      initial.upcase
    end.gsub(/_(\S)/) do |initial|
      initial.gsub(/_/, '').upcase
    end
    klass = const_get(class_name) rescue nil
    yield klass if klass
  end
  self
end