MCPcopy Index your code
hub / github.com/teambit/bit / runJsonHandler

Method runJsonHandler

src/cli/command-runner.ts:47–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45 }
46
47 private async runJsonHandler() {
48 if (!this.flags.json) return null;
49 if (!this.command.json) throw new Error(`command "${this.command.name}" doesn't implement "json" method`);
50 const result = await this.command.json(this.args, this.flags);
51 loader.off();
52 const code = result.code || 0;
53 const data = result.data || result;
54 return this.writeAndExit(JSON.stringify(data, null, 2), code);
55 }
56
57 private async runRenderHandler() {
58 if (!this.command.render) throw new Error('runRenderHandler expects command.render to be implemented');

Callers 1

runCommandMethod · 0.95

Calls 3

writeAndExitMethod · 0.95
jsonMethod · 0.65
stringifyMethod · 0.45

Tested by

no test coverage detected