Class: HammerCLIExperimental::ConfigCommand

Inherits:
HammerCLI::AbstractCommand
  • Object
show all
Defined in:
lib/hammer_cli_experimental/config.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/hammer_cli_experimental/config.rb', line 14

def execute
  if option_paths?
    puts settings.path_history
  elsif option_show?
    puts settings.settings.to_yaml
  elsif option_show_by_path?
    settings.path_history.each do |cfg_file|
      puts cfg_file
      puts YAML::load(File.open(cfg_file)).to_yaml
      puts
    end
  end
  HammerCLI::EX_OK
end

#validate_optionsObject



10
11
12
# File 'lib/hammer_cli_experimental/config.rb', line 10

def validate_options
  validator.one_of(:option_paths, :option_show, :option_show_by_path).required
end