Class: ShapeupCli::Commands::ConfigCmd

Inherits:
Base
  • Object
show all
Defined in:
lib/shapeup_cli/commands/config_cmd.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#agent_help?, #initialize, run

Constructor Details

This class inherits a constructor from ShapeupCli::Commands::Base

Class Method Details

.metadataObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/shapeup_cli/commands/config_cmd.rb', line 6

def self.
  {
    command: "config",
    path: "shapeup config",
    short: "Show and manage CLI configuration",
    subcommands: [
      { name: "show", short: "Show current config (default)", path: "shapeup config show" },
      { name: "set", short: "Set a config value", path: "shapeup config set <key> <value>" },
      { name: "init", short: "Create .shapeup/config.json for this directory", path: "shapeup config init <org>" }
    ],
    flags: [],
    notes: [
      "Config keys: org (organisation name or ID), host (ShapeUp URL)",
      "Resolution order: --org flag > .shapeup/config.json > ~/.config/shapeup/config.json"
    ],
    examples: [
      "shapeup config show",
      "shapeup config set org \"Acme Corp\"",
      "shapeup config init \"Acme Corp\""
    ]
  }
end

Instance Method Details

#executeObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/shapeup_cli/commands/config_cmd.rb', line 29

def execute
  subcommand = positional_arg(0)

  case subcommand
  when "set"  then set
  when "show" then show
  when "init" then init_project
  else show
  end
end