Sha256: 667d9e1cb643c898fd35420fd9f0d81dba6304ec56bc52694bedf626eedd4937
Contents?: true
Size: 1.02 KB
Versions: 15
Compression:
Stored size: 1.02 KB
Contents
require 'command_kit/command' module Foo class CLI class Config < CommandKit::Command # # The `config set` sub-command. # class Set < CommandKit::Command usage '[options] NAME' argument :name, required: true, desc: 'Configuration variable name to set' argument :value, required: true, desc: 'Configuration variable value to set' description 'Sets a configuration variable' CONFIG = { 'name' => 'John Smith', 'email' => 'john.smith@example.com' } # # Runs the `config get` sub-command. # # @param [String] name # The name argument. # def run(name,value) unless CONFIG.has_key?(name) print_error "unknown config variable: #{name}" exit(1) end puts "Configuration variable #{name} was #{CONFIG.fetch(name)}, but is now #{value}" end end end end end
Version data entries
15 entries across 15 versions & 2 rubygems