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
25
26
27
28
29
30
31
32
33
# 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>" },
      { name: "create", short: "Create a cycle", path: "shapeup cycle create \"Title\" --start <date> --end <date>" },
      { name: "edit", short: "Update a cycle's title or dates", path: "shapeup cycle edit <id> --title \"New\"" },
      { name: "delete", short: "Delete a cycle (only if it has no pitches)", path: "shapeup cycle delete <id>" }
    ],
    flags: [
      { name: "status", type: "string", usage: "Filter by status: active, past, future, all" },
      { name: "title", type: "string", usage: "Cycle title (create/edit)" },
      { name: "start", type: "string", usage: "Start date YYYY-MM-DD (create/edit)" },
      { name: "end", type: "string", usage: "End date YYYY-MM-DD (create/edit)" }
    ],
    examples: [
      "shapeup cycles",
      "shapeup cycles --status active",
      "shapeup cycle show 12",
      "shapeup cycle create \"Cycle 13\" --start 2026-08-03 --end 2026-09-11",
      "shapeup cycle edit 12 --title \"Renamed\"",
      "shapeup cycle delete 12"
    ]
  }
end

Instance Method Details

#executeObject



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/shapeup_cli/commands/cycle.rb', line 35

def execute
  subcommand = positional_arg(0)

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