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

Function splitFolderPath

apps/desktop/src/cli/commands/folders.ts:24–34  ·  view source on GitHub ↗
(spec: string)

Source from the content-addressed store, hash-verified

22}
23
24function splitFolderPath(spec: string): FolderRef {
25 const trimmed = spec.replace(/^\/+|\/+$/g, '')
26 if (!trimmed) throw new Error('Folder path must not be empty.')
27 const [head, ...rest] = trimmed.split('/')
28 if (!TOP_FOLDERS.includes(head as NoteFolder)) {
29 throw new Error(
30 `Folder path must start with one of ${TOP_FOLDERS.join(', ')} (got "${head}").`
31 )
32 }
33 return { folder: head as NoteFolder, subpath: rest.join('/') }
34}
35
36export async function cmdFolderList(vault: string, args: ParsedArgs): Promise<void> {
37 const folders = await listFolders(vault)

Callers 3

cmdFolderCreateFunction · 0.85
cmdFolderRenameFunction · 0.85
cmdFolderDeleteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected