Class: RHC::CommandHelpBindings

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/rhc/help_formatter.rb

Constant Summary

Constants included from Helpers

Helpers::BOUND_WARNING, Helpers::PREFIX, Helpers::ROLES

Instance Method Summary collapse

Methods included from Helpers

#agree, #certificate_file, #client_from_options, #collect_env_vars, #color, #confirm_action, #date, #datetime_rfc3339, #debug, #debug?, #debug_error, #decode_json, #deprecated, #deprecated_command, #disable_deprecated?, #distance_of_time_in_words, #env_var_regex_pattern, #error, #exec, #host_exists?, #hosts_file_contains?, #human_size, #info, #interactive?, #jruby?, #mac?, #openshift_online_server?, #openshift_rest_endpoint, #openshift_server, #openshift_url, #pluralize, #results, #role_name, #run_with_tee, #ssh_string, #ssh_string_parts, #ssl_options, #success, #system_path, #table_heading, #to_host, #to_uri, #token_for_user, #unix?, #user_agent, #warn, #windows?, #with_tolerant_encoding

Methods included from OutputHelpers

#default_display_env_var, #display_app, #display_app_configurations, #display_authorization, #display_cart, #display_cart_storage_info, #display_cart_storage_list, #display_deployment, #display_deployment_list, #display_domain, #display_env_var_list, #display_key, #display_team, #format_cart_gears, #format_cart_header, #format_gear_info, #format_key_header, #format_scaling_info, #format_usage_message

Constructor Details

#initialize(command, instance_commands, runner) ⇒ CommandHelpBindings

Returns a new instance of CommandHelpBindings.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/rhc/help_formatter.rb', line 34

def initialize(command, instance_commands, runner)
  @command = command
  @actions =
    if command.root?
      instance_commands.sort_by{ |c| c[0] }.collect do |command_name, command_class|
        next if command_class.summary.nil?
        m = /^#{command.name}[\-]([^ ]+)/.match(command_name)
        # if we have a match and it is not an alias then we can use it
        m and command_name == command_class.name ? {:name => m[1], :summary => command_class.summary || ""} : nil
      end
    else
      []
    end
  @actions.compact!
  @global_options = runner.options
  @runner = runner
end

Instance Method Details

#program(*args) ⇒ Object



51
52
53
# File 'lib/rhc/help_formatter.rb', line 51

def program(*args)
  @runner.program *args
end