(spec: string)
| 22 | } |
| 23 | |
| 24 | function 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 | |
| 36 | export async function cmdFolderList(vault: string, args: ParsedArgs): Promise<void> { |
| 37 | const folders = await listFolders(vault) |
no outgoing calls
no test coverage detected