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

Function resolveBody

apps/desktop/src/cli/args.ts:109–122  ·  view source on GitHub ↗
(
  args: ParsedArgs,
  fallbackPositional?: string
)

Source from the content-addressed store, hash-verified

107 * (nothing) => undefined
108 */
109export async function resolveBody(
110 args: ParsedArgs,
111 fallbackPositional?: string
112): Promise<string | undefined> {
113 const flag = getString(args, 'body')
114 if (flag === '-') return await readStdin()
115 if (flag != null) return flag
116 if (fallbackPositional != null && fallbackPositional !== '') return fallbackPositional
117 if (!process.stdin.isTTY) {
118 const piped = await readStdin()
119 if (piped.trim()) return piped
120 }
121 return undefined
122}

Callers 4

cmdCreateFunction · 0.85
cmdWriteFunction · 0.85
cmdAppendFunction · 0.85
cmdPrependFunction · 0.85

Calls 2

getStringFunction · 0.85
readStdinFunction · 0.85

Tested by

no test coverage detected