Class: HammerCLI::Apipie::Command
- Inherits:
-
HammerCLI::AbstractCommand
- Object
- Clamp::Command
- HammerCLI::AbstractCommand
- HammerCLI::Apipie::Command
- Defined in:
- lib/hammer_cli/apipie/command.rb
Instance Attribute Summary
Attributes inherited from HammerCLI::AbstractCommand
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Messages
#failure_message, #failure_message_for, #handle_exception, included, #success_message, #success_message_for
Methods included from Options
#get_option_value, #method_options, #method_options_for_params
Methods included from Resource
#action, #connection_options, included, #parent_command_resource, #resource, #resource_config
Methods inherited from HammerCLI::AbstractCommand
#adapter, add_option_details_section, add_option_schema, add_sets_help, build_options, #clean_up_context, command_extensions, #exception_handler, extend_help, extend_output_definition, extend_with, family_registry, help, help_extension_blocks, inherited_command_extensions, #initialize, #interactive?, option_builder, option_families, option_family, output, #output, #output_definition, output_definition, #parent_command, #parse, #run, use_option, validate_options, #validate_options
Methods included from Subcommand
Constructor Details
This class inherits a constructor from HammerCLI::AbstractCommand
Class Method Details
.apipie_options(*args) ⇒ Object
29 30 31 |
# File 'lib/hammer_cli/apipie/command.rb', line 29 def self.(*args) self.(*args) end |
.create_option_builder ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/hammer_cli/apipie/command.rb', line 21 def self.create_option_builder builder = super builder.builders += [ OptionBuilder.new(resource, resource.action(action), :require_options => false) ] if resource_defined? builder end |
.desc(desc = nil) ⇒ Object
15 16 17 18 19 |
# File 'lib/hammer_cli/apipie/command.rb', line 15 def self.desc(desc=nil) super(desc) || resource.action(action).apidoc[:apis][0][:short_description] || " " rescue " " end |
Instance Method Details
#execute ⇒ Object
33 34 35 36 37 |
# File 'lib/hammer_cli/apipie/command.rb', line 33 def execute d = send_request print_data(d) return HammerCLI::EX_OK end |
#help ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/hammer_cli/apipie/command.rb', line 39 def help help_str = super if !resource || (!action.nil? && !resource.has_action?(action)) help_str << "\n" + _("Unfortunately the server does not support such operation.") + "\n" end help_str end |