Class: GDK::Command::Config

Inherits:
BaseCommand show all
Defined in:
lib/gdk/command/config.rb

Overview

Handles ‘gdk config` command execution

This command accepts the following subcommands:

  • list

  • get <config key>

  • set <config key> <value>

Instance Attribute Summary

Attributes inherited from BaseCommand

#stderr, #stdout

Instance Method Summary collapse

Methods inherited from BaseCommand

#config, #display_help_message, #help, #initialize, #print_help, #print_ready_message, #ready_messages, validate_config?

Constructor Details

This class inherits a constructor from GDK::Command::BaseCommand

Instance Method Details

#run(args = []) ⇒ Object



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

def run(args = [])
  case args.shift
  when 'get'
    config_get(*args)
  when 'set'
    GDK::Output.abort('Usage: gdk config set <name> <value>') if args.length != 2

    config_set(*args)
  when 'list'
    GDK::Output.puts(config)
    true
  else
    GDK::Output.warn('Usage: gdk config [<get>|set] <name> [<value>]')
    GDK::Output.warn('       gdk config list')
    abort
  end
end