Class: ShapeupCli::Commands::Pitches

Inherits:
Base
  • Object
show all
Defined in:
lib/shapeup_cli/commands/pitches.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/shapeup_cli/commands/pitches.rb', line 6

def self.
  {
    command: "pitches",
    path: "shapeup pitches",
    short: "List and show pitches (packages)",
    subcommands: [
      { name: "list", short: "List pitches (default)", path: "shapeup pitches list" },
      { name: "show", short: "Show pitch details with scopes and tasks", path: "shapeup pitches show <id>" },
      { name: "create", short: "Create a new pitch", path: "shapeup pitches create \"Title\" --stream \"Name\"" },
      { name: "update", short: "Update a pitch's title, status, appetite, stream, or cycle", path: "shapeup pitches update <id> --status shaped" },
      { name: "extend", short: "Link a pitch as a continuation of a predecessor", path: "shapeup pitches extend <id> --predecessor <id>" },
      { name: "detach", short: "Remove a pitch's predecessor link", path: "shapeup pitches detach <id>" },
      { name: "delete", short: "Delete a pitch (must have no scopes)", path: "shapeup pitches delete <id>" },
      { name: "help", short: "Show usage", path: "shapeup pitches help" }
    ],
    flags: [
      { name: "status", type: "string", usage: "Filter by, or set, status: idea, framed, shaped" },
      { name: "cycle", type: "string", usage: "Filter by cycle ID (list), or assign to cycle ID (update)" },
      { name: "tag", type: "string", usage: "Filter by tag name" },
      { name: "limit", type: "integer", usage: "Limit number of results" },
      { name: "stream", type: "string", usage: "Stream name or ID (for create/update)" },
      { name: "appetite", type: "string", usage: "Appetite: unknown, small_batch, big_batch (create default: big_batch)" },
      { name: "cycle-id", type: "string", usage: "Assign to cycle ID (for create)" },
      { name: "title", type: "string", usage: "New title (for update)" },
      { name: "content", type: "string", usage: "New description (for update)" },
      { name: "predecessor", type: "string", usage: "Predecessor pitch ID (for extend)" },
      { name: "no-comments", type: "bool", usage: "Hide embedded comments on show (default: show)" },
      { name: "comments-limit", type: "integer", usage: "Max comments to embed on show (default: 10, max: 50)" }
    ],
    examples: [
      "shapeup pitches list",
      "shapeup pitches list --status shaped",
      "shapeup pitches list --cycle 5",
      "shapeup pitches list --tag q3-plan",
      "shapeup pitch 42",
      "shapeup pitch 42 --json",
      "shapeup pitches create \"Redesign Search\" --stream \"Platform\"",
      "shapeup pitches create \"Auth Overhaul\" --stream \"Platform\" --appetite small_batch",
      "shapeup pitches update 42 --status shaped",
      "shapeup pitches update 42 --title \"Redesign Search v2\" --appetite small_batch",
      "shapeup pitches update 42 --cycle 5",
      "shapeup pitches extend 42 --predecessor 30",
      "shapeup pitches detach 42",
      "shapeup pitches delete 42"
    ]
  }
end

Instance Method Details

#executeObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/shapeup_cli/commands/pitches.rb', line 54

def execute
  subcommand = positional_arg(0)

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