Class: ShapeupCli::Commands::Tasks

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

def self.
  {
    command: "tasks",
    path: "shapeup tasks",
    short: "Manage tasks within scopes and pitches",
    aliases: { "todo" => "tasks create", "done" => "tasks complete", "undone" => "tasks uncomplete" },
    subcommands: [
      { name: "list", short: "List tasks", path: "shapeup tasks list" },
      { name: "create", short: "Create a task", path: "shapeup todo \"Description\" --pitch <id>" },
      { name: "complete", short: "Mark task(s) as complete", path: "shapeup done <id> [<id>...]" },
      { name: "uncomplete", short: "Mark task as incomplete", path: "shapeup undone <id>" },
      { name: "update", short: "Edit a task's description or move it to a scope", path: "shapeup tasks update <id> --description \"New\"" },
      { name: "delete", short: "Delete a task", path: "shapeup tasks delete <id>" },
      { name: "assign", short: "Assign a user", path: "shapeup tasks assign <id> [--user <id>]" },
      { name: "unassign", short: "Unassign a user", path: "shapeup tasks unassign <id> [--user <id>]" }
    ],
    flags: [
      { name: "user", type: "string", usage: "User ID or 'me' (assign/unassign; defaults to me)" },
      { name: "pitch", type: "string", usage: "Pitch ID (required for create)" },
      { name: "scope", type: "string", usage: "Scope ID (filter, create target, or update target; use 'none' to unmap)" },
      { name: "assignee", type: "string", usage: "User ID or 'me' (for list)" },
      { name: "description", type: "string", usage: "New description (for update)" }
    ],
    examples: [
      "shapeup tasks list --pitch 42",
      "shapeup tasks list --assignee me",
      "shapeup todo \"Fix login bug\" --pitch 42 --scope 7",
      "shapeup done 123",
      "shapeup done 123 124 125",
      "shapeup undone 123",
      "shapeup tasks update 123 --description \"Fix login + signup bug\"",
      "shapeup tasks update 123 --scope 7",
      "shapeup tasks update 123 --scope none",
      "shapeup tasks delete 123"
    ]
  }
end

Instance Method Details

#executeObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/shapeup_cli/commands/tasks.rb', line 44

def execute
  subcommand = positional_arg(0)

  case subcommand
  when "create"     then create
  when "complete"   then complete
  when "uncomplete" then uncomplete
  when "update"     then update
  when "delete"     then delete
  when "assign"     then assign_to("Task", "tasks")
  when "unassign"   then unassign_from("Task", "tasks")
  when "list", nil  then list
  else list
  end
end