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

Function cmdFolderDelete

apps/desktop/src/cli/commands/folders.ts:87–103  ·  view source on GitHub ↗
(vault: string, args: ParsedArgs)

Source from the content-addressed store, hash-verified

85}
86
87export 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}

Callers

nothing calls this directly

Calls 6

getStringFunction · 0.85
getBoolFunction · 0.85
splitFolderPathFunction · 0.85
emitJsonFunction · 0.85
emitOkFunction · 0.85
deleteFolderFunction · 0.50

Tested by

no test coverage detected