Class: HammerCLI::DefaultsCommand::ListDefaultsCommand
- Inherits:
-
HammerCLI::DefaultsCommand
- Object
- Clamp::Command
- AbstractCommand
- HammerCLI::DefaultsCommand
- HammerCLI::DefaultsCommand::ListDefaultsCommand
- 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
77 78 79 |
# File 'lib/hammer_cli/defaults_commands.rb', line 77 def adapter @context[:adapter] || :table end |
#execute ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/hammer_cli/defaults_commands.rb', line 57 def execute data = context[:defaults].defaults_settings.map do |key, val| { :parameter => key.to_s, :value => val[:provider] ? "Provided by: " + val[:provider].to_s.capitalize : val[:value] } end fields = HammerCLI::Output::Dsl.new.build do field :parameter, _('Parameter') field :value, _('Value'), Fields::List end definition = HammerCLI::Output::Definition.new definition.append(fields) print_collection(definition, data) HammerCLI::EX_OK end |