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

Function cmdCreate

apps/desktop/src/cli/commands/notes.ts:96–108  ·  view source on GitHub ↗
(vault: string, args: ParsedArgs)

Source from the content-addressed store, hash-verified

94}
95
96export async function cmdCreate(vault: string, args: ParsedArgs): Promise<void> {
97 const folder = parseFolderFlag(getString(args, 'folder')) ?? 'inbox'
98 if (folder === 'trash') {
99 throw new Error('Refusing to create a note directly in trash.')
100 }
101 const title = getString(args, 'title') ?? args.positionals[0]
102 const subpath = getString(args, 'subpath') ?? ''
103 const tags = getMany(args, 'tag').map((t) => t.replace(/^#/, ''))
104 const inputBody = await resolveBody(args)
105 const composed = composeBody(title, inputBody, tags)
106 const meta = await createNote(vault, folder, title, subpath, composed)
107 emitCreated(meta, args)
108}
109
110function composeBody(
111 title: string | undefined,

Callers

nothing calls this directly

Calls 7

parseFolderFlagFunction · 0.85
getStringFunction · 0.85
getManyFunction · 0.85
resolveBodyFunction · 0.85
emitCreatedFunction · 0.85
composeBodyFunction · 0.70
createNoteFunction · 0.50

Tested by

no test coverage detected