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

Function cmdTaskToggle

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

Source from the content-addressed store, hash-verified

36}
37
38export async function cmdTaskToggle(vault: string, args: ParsedArgs): Promise<void> {
39 const id = getString(args, 'id') ?? args.positionals[0]
40 if (!id) throw new Error('zn task toggle requires a task id from `zn task list`.')
41 const next = await toggleTask(vault, id)
42 if (next == null) {
43 throw new Error(
44 `Task ${id} no longer exists at that location — the file may have changed. Run \`zn task list\` again.`
45 )
46 }
47 if (getBool(args, 'json')) {
48 emitJson(next)
49 return
50 }
51 const state = next.checked ? 'done' : next.waiting ? 'waiting' : 'open'
52 emitOk(`Toggled ${id} → ${state}`)
53}

Callers

nothing calls this directly

Calls 5

getStringFunction · 0.85
toggleTaskFunction · 0.85
getBoolFunction · 0.85
emitJsonFunction · 0.85
emitOkFunction · 0.85

Tested by

no test coverage detected