Class: GemContribute::CLI::Config
- Inherits:
-
Object
- Object
- GemContribute::CLI::Config
- Defined in:
- lib/gem_contribute/cli/config.rb
Overview
‘gem-contribute config <subcommand>`
Subcommands:
set <key> <value> Write a value to ~/.config/gem-contribute/config.yml
get <key> Print the current value of a key
list Print all configured values
Constant Summary collapse
- USAGE =
<<~USAGE Usage: gem-contribute config <subcommand> Subcommands: set <key> <value> Set a configuration value. get <key> Print the current value of a key. list Print all configured values. Keys: clone_root Directory where forks are cloned. Set with `gem-contribute init` (interactive) or `gem-contribute config set clone_root <path>`. USAGE
Instance Method Summary collapse
-
#initialize(stdout: $stdout, stderr: $stderr, config: GemContribute::Config.new) ⇒ Config
constructor
A new instance of Config.
- #run(argv) ⇒ Object
Constructor Details
#initialize(stdout: $stdout, stderr: $stderr, config: GemContribute::Config.new) ⇒ Config
Returns a new instance of Config.
26 27 28 29 30 |
# File 'lib/gem_contribute/cli/config.rb', line 26 def initialize(stdout: $stdout, stderr: $stderr, config: GemContribute::Config.new) @stdout = stdout @stderr = stderr @config = config end |
Instance Method Details
#run(argv) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/gem_contribute/cli/config.rb', line 32 def run(argv) case argv.shift when "set" then set(argv) when "get" then get(argv) when "list" then list when nil, "help", "-h", "--help" @stdout.puts USAGE 0 else @stderr.puts "gem-contribute: unknown config subcommand" @stderr.puts USAGE 2 end end |