Class: HammerCLI::DefaultsCommand::ProvidersDefaultsCommand
- Inherits:
-
HammerCLI::DefaultsCommand
- Object
- Clamp::Command
- AbstractCommand
- HammerCLI::DefaultsCommand
- HammerCLI::DefaultsCommand::ProvidersDefaultsCommand
- Defined in:
- lib/hammer_cli/defaults_commands.rb
Instance Attribute Summary
Attributes inherited from AbstractCommand
Instance Method Summary collapse
Methods inherited from HammerCLI::DefaultsCommand
#added_default_message, #bad_input, #defaults_not_supported_by_provider, #param_deleted, #provider_prob_message, #variable_not_found
Methods inherited from AbstractCommand
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, help_extension_blocks, inherited_command_extensions, #initialize, #interactive?, option, 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
Instance Method Details
#adapter ⇒ Object
48 49 50 |
# File 'lib/hammer_cli/defaults_commands.rb', line 48 def adapter @context[:adapter] || :table end |
#execute ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/hammer_cli/defaults_commands.rb', line 26 def execute data = context[:defaults].providers.map do |key, val| { :provider => key.to_s, :defaults => (val.supported_defaults || ['*']).map(&:to_s), :description => val.description } end fields = HammerCLI::Output::Dsl.new.build do field :provider, _('Provider') field :defaults, _('Supported defaults'), Fields::List field :description, _('Description') end definition = HammerCLI::Output::Definition.new definition.append(fields) print_collection(definition, data) HammerCLI::EX_OK end |