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

Function showTaskCmd

internal/app/show.go:38–92  ·  view source on GitHub ↗

showTaskCmd implements `flow show task [ ]`.

(args []string)

Source from the content-addressed store, hash-verified

36
37// showTaskCmd implements `flow show task [<ref>]`.
38func showTaskCmd(args []string) int {
39 fs := flagSet("show task")
40 if err := fs.Parse(args); err != nil {
41 return 2
42 }
43 ref := ""
44 if fs.NArg() > 0 {
45 ref = fs.Arg(0)
46 }
47
48 dbPath, err := flowDBPath()
49 if err != nil {
50 fmt.Fprintf(os.Stderr, "error: %v\n", err)
51 return 1
52 }
53 db, err := flowdb.OpenDB(dbPath)
54 if err != nil {
55 fmt.Fprintf(os.Stderr, "error: open db: %v\n", err)
56 return 1
57 }
58 defer db.Close()
59
60 var t *flowdb.Task
61 if ref == "" {
62 // No explicit ref: reverse-lookup via the current Claude session.
63 bound, lookupErr := currentSessionTask(db)
64 if lookupErr != nil {
65 if isNoBindingErr(lookupErr) {
66 if currentSessionID() == "" {
67 fmt.Fprintln(os.Stderr, "error: no task ref given and not running inside a Claude session ($CLAUDE_CODE_SESSION_ID unset)")
68 } else {
69 fmt.Fprintln(os.Stderr, "error: no task ref given and this Claude session is not bound to a task — pass a slug or run `flow do --here <slug>` first")
70 }
71 return 1
72 }
73 fmt.Fprintf(os.Stderr, "error: lookup task by session: %v\n", lookupErr)
74 return 1
75 }
76 t = bound
77 } else {
78 t, err = resolveTaskRef(db, ref)
79 if err != nil {
80 fmt.Fprintf(os.Stderr, "error: %v\n", err)
81 return 1
82 }
83 }
84
85 root, err := flowRoot()
86 if err != nil {
87 fmt.Fprintf(os.Stderr, "error: %v\n", err)
88 return 1
89 }
90 printTaskMetadata(db, t, root)
91 return 0
92}
93
94// showProjectCmd implements `flow show project [<ref>]`. With no
95// argument, falls back to the project of the task bound to the

Callers 1

cmdShowFunction · 0.85

Calls 9

OpenDBFunction · 0.92
flagSetFunction · 0.85
flowDBPathFunction · 0.85
currentSessionTaskFunction · 0.85
isNoBindingErrFunction · 0.85
currentSessionIDFunction · 0.85
resolveTaskRefFunction · 0.85
flowRootFunction · 0.85
printTaskMetadataFunction · 0.85

Tested by

no test coverage detected