Class: ShapeupCli::Commands::Comments

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

def self.
  {
    command: "comments",
    path: "shapeup comments",
    short: "List and add comments on issues, pitches, scopes, and tasks",
    subcommands: [
      { name: "list", short: "List comments", path: "shapeup comments list --issue <id>" },
      { name: "add", short: "Add a comment", path: 'shapeup comments add --issue <id> "Comment text"' },
      { name: "edit", short: "Edit your own comment", path: 'shapeup comments edit <comment_id> "New text"' },
      { name: "remove", short: "Delete your own comment", path: "shapeup comments remove <comment_id>" }
    ],
    flags: [
      { name: "issue", type: "string", usage: "Issue ID" },
      { name: "pitch", type: "string", usage: "Pitch ID" },
      { name: "scope", type: "string", usage: "Scope ID" },
      { name: "task", type: "string", usage: "Task ID" }
    ],
    examples: [
      "shapeup comments list --issue 42",
      'shapeup comments add --issue 42 "Investigated — this is a CSS issue in the navbar"',
      "shapeup comments list --pitch 10",
      'shapeup comments add --pitch 10 "Shaped and ready for betting"',
      'shapeup comments edit 88 "Updated: this is a navbar z-index issue"',
      "shapeup comments remove 88"
    ]
  }
end

Instance Method Details

#executeObject



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/shapeup_cli/commands/comments.rb', line 34

def execute
  subcommand = positional_arg(0)

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