Class: GemContribute::CLI::Config

Inherits:
Object
  • Object
show all
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>`.
    editor               Editor command for `fix -e`. Falls back to $EDITOR.
                         Example: gem-contribute config set editor code
    ai_tool              Shell command for `fix -a` (run in clone dir).
                         Example: gem-contribute config set ai_tool "claude ."
    comment_on_fix       Whether `fix` posts a "working on this" comment.
                         Default: true. Per-repo overrides via
                         `comment_on_fix_overrides` in the YAML.
USAGE

Instance Method Summary collapse

Constructor Details

#initialize(stdout: $stdout, stderr: $stderr, output: nil, config: GemContribute::Config.new) ⇒ Config

Returns a new instance of Config.



33
34
35
36
37
# File 'lib/gem_contribute/cli/config.rb', line 33

def initialize(stdout: $stdout, stderr: $stderr, output: nil,
               config: GemContribute::Config.new)
  @output = output || Output::Standard.new(out: stdout, err: stderr)
  @config = config
end

Instance Method Details

#run(argv) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/gem_contribute/cli/config.rb', line 39

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"
    @output.info(USAGE)
    0
  else
    @output.error("gem-contribute: unknown config subcommand")
    @output.error(USAGE)
    2
  end
end