(vault: string, args: ParsedArgs)
| 36 | } |
| 37 | |
| 38 | export 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 | } |
nothing calls this directly
no test coverage detected