Class: ShapeupCli::Commands::Checklist

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

def self.
  {
    command: "checklist",
    path: "shapeup checklist",
    short: "Manage the checklist on a pitch or issue",
    subcommands: [
      { name: "list", short: "List items (default)", path: "shapeup checklist --pitch <id>" },
      { name: "add", short: "Add an item", path: 'shapeup checklist add --pitch <id> "Item text"' },
      { name: "tick", short: "Mark an item complete", path: "shapeup checklist tick <item_id>" },
      { name: "untick", short: "Mark an item incomplete", path: "shapeup checklist untick <item_id>" },
      { name: "edit", short: "Rename an item", path: 'shapeup checklist edit <item_id> "New text"' },
      { name: "remove", short: "Delete an item", path: "shapeup checklist remove <item_id>" }
    ],
    flags: [
      { name: "pitch", type: "string", usage: "Pitch ID (for list/add)" },
      { name: "issue", type: "string", usage: "Issue ID (for list/add)" }
    ],
    examples: [
      "shapeup checklist --pitch 42",
      "shapeup checklist --issue 7",
      'shapeup checklist add --pitch 42 "Confirm Slack webhook"',
      "shapeup checklist tick 18",
      "shapeup checklist untick 18",
      'shapeup checklist edit 18 "Confirm Slack webhook secret rotation"',
      "shapeup checklist remove 18"
    ]
  }
end

Instance Method Details

#executeObject



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

def execute
  subcommand = positional_arg(0)

  case subcommand
  when "add"        then add
  when "tick"       then tick
  when "untick"     then untick
  when "edit"       then edit
  when "remove"     then remove
  when "list", nil  then list
  else list
  end
end