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

Function composeBody

apps/desktop/src/cli/commands/notes.ts:110–121  ·  view source on GitHub ↗
(
  title: string | undefined,
  body: string | undefined,
  tags: string[]
)

Source from the content-addressed store, hash-verified

108}
109
110function composeBody(
111 title: string | undefined,
112 body: string | undefined,
113 tags: string[]
114): string | undefined {
115 if (body == null && tags.length === 0) return undefined
116 const heading = title ? `# ${title}\n\n` : ''
117 const tagLine = tags.length > 0 ? tags.map((t) => `#${t}`).join(' ') + '\n\n' : ''
118 const bodyText = body ?? ''
119 const out = `${heading}${tagLine}${bodyText}`
120 return out.endsWith('\n') ? out : out + '\n'
121}
122
123export async function cmdWrite(vault: string, args: ParsedArgs): Promise<void> {
124 const rel = requirePath(args)

Callers 1

cmdCreateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected