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
# 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>" }
    ],
    flags: [
      { 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



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/shapeup_cli/commands/tasks.rb', line 41

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 "list", nil  then list
  else list
  end
end