MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / cmdTaskList

Function cmdTaskList

apps/desktop/src/cli/commands/tasks.ts:10–36  ·  view source on GitHub ↗
(vault: string, args: ParsedArgs)

Source from the content-addressed store, hash-verified

8import { emitJson, emitLine, emitOk, pad, truncate } from '../format.js'
9
10export async function cmdTaskList(vault: string, args: ParsedArgs): Promise<void> {
11 const showAll = getBool(args, 'all')
12 const onlyUnchecked = getBool(args, 'unchecked')
13 const tag = getString(args, 'tag')?.replace(/^#/, '').toLowerCase()
14
15 let tasks = await scanAllTasks(vault)
16 if (!showAll) {
17 if (onlyUnchecked) tasks = tasks.filter((t) => !t.checked)
18 else tasks = tasks.filter((t) => !t.checked && !t.waiting)
19 }
20 if (tag) tasks = tasks.filter((t) => t.tags.includes(tag))
21
22 if (getBool(args, 'json')) {
23 emitJson(tasks)
24 return
25 }
26 if (tasks.length === 0) {
27 emitLine('No tasks found.')
28 return
29 }
30 for (const t of tasks) {
31 const box = t.checked ? '[x]' : t.waiting ? '[~]' : '[ ]'
32 const due = t.due ? ` due:${t.due}` : ''
33 const pri = t.priority ? ` !${t.priority}` : ''
34 emitLine(`${box} ${pad(t.id, 40)} ${truncate(t.content, 80)}${due}${pri}`)
35 }
36}
37
38export async function cmdTaskToggle(vault: string, args: ParsedArgs): Promise<void> {
39 const id = getString(args, 'id') ?? args.positionals[0]

Callers

nothing calls this directly

Calls 7

padFunction · 0.90
getBoolFunction · 0.85
getStringFunction · 0.85
emitJsonFunction · 0.85
emitLineFunction · 0.85
truncateFunction · 0.85
scanAllTasksFunction · 0.50

Tested by

no test coverage detected