Class: ShapeupCli::Commands::Cycle

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

def self.
  {
    command: "cycle",
    path: "shapeup cycle",
    short: "List and show cycles",
    subcommands: [
      { name: "list", short: "List cycles (default)", path: "shapeup cycles" },
      { name: "show", short: "Show cycle details with pitches and progress", path: "shapeup cycle show <id>" }
    ],
    flags: [
      { name: "status", type: "string", usage: "Filter by status: active, past, future, all" }
    ],
    examples: [
      "shapeup cycles",
      "shapeup cycles --status active",
      "shapeup cycle show 12"
    ]
  }
end

Instance Method Details

#executeObject



26
27
28
29
30
31
32
33
34
35
# File 'lib/shapeup_cli/commands/cycle.rb', line 26

def execute
  subcommand = positional_arg(0)

  case subcommand
  when "show"  then show
  when "list", nil then list
  else
    subcommand.match?(/\A\d+\z/) ? show(subcommand) : list
  end
end