MCPcopy
hub / github.com/callstack/agent-device / writeCommandOutput

Function writeCommandOutput

src/cli/commands/shared.ts:4–15  ·  view source on GitHub ↗
(
  flags: CliFlags,
  data: unknown,
  renderHuman?: () => string | null | undefined,
)

Source from the content-addressed store, hash-verified

2import { printJson } from '../../utils/output.ts';
3
4export function writeCommandOutput(
5 flags: CliFlags,
6 data: unknown,
7 renderHuman?: () => string | null | undefined,
8): void {
9 if (flags.json) {
10 printJson({ success: true, data });
11 return;
12 }
13 const text = renderHuman?.();
14 if (text) writeLine(text);
15}
16
17function writeLine(text: string): void {
18 process.stdout.write(text.endsWith('\n') ? text : `${text}\n`);

Callers 12

proxyCommandFunction · 0.90
writeGenericCliOutputFunction · 0.90
writeCliOutputFunction · 0.90
screenshotCommandFunction · 0.90
diffCommandFunction · 0.90
connectCommandFunction · 0.90
disconnectCommandFunction · 0.90
connectionCommandFunction · 0.90
authCommandFunction · 0.90

Calls 2

printJsonFunction · 0.90
writeLineFunction · 0.70

Tested by

no test coverage detected