(vault: string, args: ParsedArgs)
| 85 | } |
| 86 | |
| 87 | export async function cmdFolderDelete(vault: string, args: ParsedArgs): Promise<void> { |
| 88 | const target = args.positionals[0] ?? getString(args, 'path') |
| 89 | if (!target) throw new Error('zn folder delete requires a folder path.') |
| 90 | if (!getBool(args, 'yes')) { |
| 91 | throw new Error( |
| 92 | 'zn folder delete is destructive. Re-run with --yes to confirm.' |
| 93 | ) |
| 94 | } |
| 95 | const ref = splitFolderPath(target) |
| 96 | if (!ref.subpath) throw new Error('Cannot delete a top-level folder.') |
| 97 | await deleteFolder(vault, ref.folder, ref.subpath) |
| 98 | if (getBool(args, 'json')) { |
| 99 | emitJson({ ok: true, folder: ref.folder, subpath: ref.subpath }) |
| 100 | return |
| 101 | } |
| 102 | emitOk(`Deleted ${ref.folder}/${ref.subpath}`) |
| 103 | } |
nothing calls this directly
no test coverage detected