MCPcopy Create free account
hub / github.com/Facets-cloud/flow / cmdUpdateTask

Function cmdUpdateTask

internal/app/update.go:47–314  ·  view source on GitHub ↗

cmdUpdateTask implements `flow update task [--work-dir ] [--mkdir] [--status ] [--assignee ] [--due-date ] [--waiting ...] [--tag ...]`. At least one field-changing flag must be given. Status accepts any of backlog|in-progress|done. The session_id invariant (only backlog

(args []string)

Source from the content-addressed store, hash-verified

45// $CLAUDE_CODE_SESSION_ID), which prevents wrong-session attachment
46// by construction.
47func cmdUpdateTask(args []string) int {
48 if len(args) < 1 {
49 fmt.Fprintln(os.Stderr, "error: update task requires a task ref")
50 return 2
51 }
52 ref := args[0]
53 fs := flagSet("update task")
54 workDir := fs.String("work-dir", "", "new absolute work directory")
55 mkdir := fs.Bool("mkdir", false, "create --work-dir if it does not exist")
56 status := fs.String("status", "", "new status: backlog|in-progress|done")
57 priority := fs.String("priority", "", "new priority: high|medium|low")
58 assignee := fs.String("assignee", "", "new assignee (use \"\" to keep, --clear-assignee to clear)")
59 clearAssignee := fs.Bool("clear-assignee", false, "clear the assignee (back to default = self)")
60 dueDate := fs.String("due-date", "", "new due date (YYYY-MM-DD, today, tomorrow, monday, 3d)")
61 clearDue := fs.Bool("clear-due", false, "clear the due date")
62 waiting := fs.String("waiting", "", "set waiting_on freeform note (\"<who or what>\")")
63 clearWaiting := fs.Bool("clear-waiting", false, "clear waiting_on")
64 var addTags stringSliceFlag
65 fs.Var(&addTags, "tag", "add a tag (repeatable: --tag foo --tag bar)")
66 var removeTags stringSliceFlag
67 fs.Var(&removeTags, "remove-tag", "remove a tag (repeatable)")
68 clearTags := fs.Bool("clear-tags", false, "remove all tags from the task")
69 if err := fs.Parse(args[1:]); err != nil {
70 return 2
71 }
72 anyField := *workDir != "" || *status != "" || *priority != "" ||
73 *assignee != "" || *clearAssignee || *dueDate != "" || *clearDue ||
74 *waiting != "" || *clearWaiting ||
75 len(addTags) > 0 || len(removeTags) > 0 || *clearTags
76 if !anyField {
77 fmt.Fprintln(os.Stderr, "error: give at least one of --work-dir, --status, --priority, --assignee, --clear-assignee, --due-date, --clear-due, --waiting, --clear-waiting, --tag, --remove-tag, --clear-tags")
78 return 2
79 }
80
81 if *status != "" && !isValidStatus(*status) {
82 fmt.Fprintf(os.Stderr,
83 "error: --status must be backlog|in-progress|done (got %q)\n", *status)
84 return 2
85 }
86
87 if *priority != "" && !isValidPriority(*priority) {
88 fmt.Fprintf(os.Stderr,
89 "error: --priority must be high|medium|low (got %q)\n", *priority)
90 return 2
91 }
92
93 if *clearAssignee && *assignee != "" {
94 fmt.Fprintln(os.Stderr, "error: --assignee and --clear-assignee are mutually exclusive")
95 return 2
96 }
97 if *clearDue && *dueDate != "" {
98 fmt.Fprintln(os.Stderr, "error: --due-date and --clear-due are mutually exclusive")
99 return 2
100 }
101 if *clearWaiting && *waiting != "" {
102 fmt.Fprintln(os.Stderr, "error: --waiting and --clear-waiting are mutually exclusive")
103 return 2
104 }

Callers 1

cmdUpdateFunction · 0.85

Calls 15

OpenDBFunction · 0.92
NowISOFunction · 0.92
ClearTaskTagsFunction · 0.92
NormalizeTagFunction · 0.92
RemoveTaskTagFunction · 0.92
AddTaskTagFunction · 0.92
flagSetFunction · 0.85
isValidStatusFunction · 0.85
isValidPriorityFunction · 0.85
resolveWorkDirFunction · 0.85
parseDueDateFunction · 0.85
flowDBPathFunction · 0.85

Tested by

no test coverage detected