Class: ShapeupCli::Commands::Auth

Inherits:
Base
  • Object
show all
Defined in:
lib/shapeup_cli/commands/auth.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
28
29
# File 'lib/shapeup_cli/commands/auth.rb', line 6

def self.
  {
    command: "auth",
    path: "shapeup auth",
    short: "Manage authentication profiles",
    subcommands: [
      { name: "status", short: "Check authentication status", path: "shapeup auth status" },
      { name: "list", short: "List configured profiles", path: "shapeup auth list" },
      { name: "switch", short: "Switch active profile", path: "shapeup auth switch <name>" },
      { name: "remove", short: "Remove a profile", path: "shapeup auth remove <name>" }
    ],
    flags: [],
    notes: [
      "Use 'shapeup login' to create a new profile via OAuth",
      "SHAPEUP_PROFILE env var overrides the default profile"
    ],
    examples: [
      "shapeup auth status",
      "shapeup auth list",
      "shapeup auth switch compass-labs",
      "shapeup auth remove old-profile"
    ]
  }
end

Instance Method Details

#executeObject



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/shapeup_cli/commands/auth.rb', line 31

def execute
  subcommand = positional_arg(0)

  case subcommand
  when "status"      then status
  when "list"        then list
  when "switch"      then switch_profile
  when "remove"      then remove
  when "help", nil   then help
  else help
  end
end