Class: Ukiryu::CliCommands::ConfigCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/ukiryu/cli_commands/config_command.rb

Overview

Configuration management command

Constant Summary collapse

CONFIG_DIR =
File.expand_path('~/.ukiryu')
CONFIG_FILE =
File.join(CONFIG_DIR, 'config.yml')

Instance Attribute Summary

Attributes inherited from BaseCommand

#config, #options

Instance Method Summary collapse

Methods inherited from BaseCommand

#apply_cli_options_to_config, #default_register_path, #initialize, #setup_register, #stringify_keys

Constructor Details

This class inherits a constructor from Ukiryu::CliCommands::BaseCommand

Instance Method Details

#run(action = 'list', key = nil, value = nil) ⇒ Object

Execute the config command

Parameters:

  • action (String) (defaults to: 'list')

    the action (list, get, set, unset)

  • key (String, nil) (defaults to: nil)

    the config key

  • value (String, nil) (defaults to: nil)

    the config value



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ukiryu/cli_commands/config_command.rb', line 18

def run(action = 'list', key = nil, value = nil)
  setup_register

  case action
  when 'list'
    action_list
  when 'get'
    action_get(key)
  when 'set'
    action_set(key, value)
  when 'unset'
    action_unset(key)
  else
    error! "Unknown action: #{action}\nValid actions: list, get, set, unset"
  end
end