Class: ShapeupCli::Commands::Issues

Inherits:
Base
  • Object
show all
Defined in:
lib/shapeup_cli/commands/issues.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/shapeup_cli/commands/issues.rb', line 6

def self.
  {
    command: "issues",
    path: "shapeup issues",
    short: "Manage issues on the kanban board",
    aliases: { "issue" => "issues show", "watching" => "issues watching" },
    subcommands: [
      { name: "list", short: "List active issues", path: "shapeup issues" },
      { name: "show", short: "Show issue details", path: "shapeup issue <id>" },
      { name: "create", short: "Create an issue", path: "shapeup issues create \"Title\" --stream <id>" },
      { name: "update", short: "Update an issue", path: "shapeup issues update <id> --title \"New title\"" },
      { name: "move", short: "Move to a kanban column", path: "shapeup issues move <id> --column <id>" },
      { name: "done", short: "Mark issue as done", path: "shapeup issues done <id>" },
      { name: "close", short: "Close issue (won't fix)", path: "shapeup issues close <id>" },
      { name: "reopen", short: "Reopen a done/closed issue", path: "shapeup issues reopen <id>" },
      { name: "icebox", short: "Move issue to icebox", path: "shapeup issues icebox <id>" },
      { name: "defrost", short: "Restore issue from icebox", path: "shapeup issues defrost <id>" },
      { name: "assign", short: "Assign a user to an issue", path: "shapeup issues assign <id> [--user <id>]" },
      { name: "unassign", short: "Unassign a user from an issue", path: "shapeup issues unassign <id> [--user <id>]" },
      { name: "watch", short: "Watch an issue", path: "shapeup issues watch <id>" },
      { name: "unwatch", short: "Stop watching an issue", path: "shapeup issues unwatch <id>" },
      { name: "watching", short: "List issues you are watching", path: "shapeup watching" },
      { name: "delete", short: "Delete an issue", path: "shapeup issues delete <id>" }
    ],
    flags: [
      { name: "stream", type: "string", usage: "Stream ID (required for create, optional filter for list)" },
      { name: "column", type: "string", usage: "Kanban column ID (for move or filter)" },
      { name: "kind", type: "string", usage: "Filter by kind: bug, request, all" },
      { name: "assignee", type: "string", usage: "User ID or 'me' (for list)" },
      { name: "user", type: "string", usage: "User ID or 'me' (for assign/unassign, defaults to 'me')" },
      { name: "tag", type: "string", usage: "Filter by tag name (for list)" },
      { name: "all", type: "bool", usage: "Include done/closed issues (hidden by default)" },
      { name: "content", type: "string", usage: "Issue content/description" },
      { name: "title", type: "string", usage: "Issue title (for update)" },
      { name: "archived", type: "bool", usage: "Include iceboxed issues in list" },
      { 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 issues",
      "shapeup issues --tag seo",
      "shapeup issues --assignee me",
      "shapeup issues --column 3",
      "shapeup issues --all",
      "shapeup issues --stream 3 --kind bug",
      "shapeup issue 42",
      "shapeup issues create \"Fix checkout\" --stream 3 --content \"The button is broken\"",
      "shapeup issues move 42 --column 5",
      "shapeup issues done 42",
      "shapeup issues close 42",
      "shapeup issues reopen 42",
      "shapeup issues icebox 42",
      "shapeup issues defrost 42",
      "shapeup issues assign 42",
      "shapeup issues assign 42 --user 7",
      "shapeup issues unassign 42",
      "shapeup issues watch 42",
      "shapeup watching"
    ]
  }
end

Instance Method Details

#executeObject



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/shapeup_cli/commands/issues.rb', line 68

def execute
  subcommand = positional_arg(0)

  case subcommand
  when "show"     then show
  when "create"   then create
  when "update"   then update
  when "move"     then move
  when "done"     then mark_done
  when "close"    then close
  when "reopen"   then reopen
  when "icebox"   then icebox
  when "defrost"  then defrost
  when "assign"   then assign
  when "unassign" then unassign
  when "watch"    then watch
  when "unwatch"  then unwatch
  when "watching" then watching
  when "delete"   then delete
  when "list", nil then list
  else
    # Bare numeric arg = show
    if subcommand&.match?(/\A\d+\z/)
      @remaining.unshift(subcommand)
      show
    else
      list
    end
  end
end