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

Function cmdFolderCreate

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

Source from the content-addressed store, hash-verified

49}
50
51export async function cmdFolderCreate(vault: string, args: ParsedArgs): Promise<void> {
52 const target = args.positionals[0] ?? getString(args, 'path')
53 if (!target) throw new Error('zn folder create requires a folder path like inbox/Work.')
54 const ref = splitFolderPath(target)
55 if (!ref.subpath) throw new Error('Cannot create the top-level folder; pick a subpath.')
56 await createFolder(vault, ref.folder, ref.subpath)
57 if (getBool(args, 'json')) {
58 emitJson({ ok: true, folder: ref.folder, subpath: ref.subpath })
59 return
60 }
61 emitOk(`Created ${ref.folder}/${ref.subpath}`)
62}
63
64export async function cmdFolderRename(vault: string, args: ParsedArgs): Promise<void> {
65 const oldPath = args.positionals[0] ?? getString(args, 'path')

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected