fix: render gh defaults as concise tables
This commit is contained in:
+14
-13
@@ -21,6 +21,7 @@ import { runDevEnvCommand } from "./src/dev-env";
|
||||
import { runArtifactRegistryCommand } from "./src/artifact-registry";
|
||||
import { runAuthBrokerCommand } from "./src/auth-broker";
|
||||
import { runGhCommand } from "./src/gh";
|
||||
import { withGhDefaultRendered } from "./src/gh/default-render";
|
||||
import { isGhContentRoute, runGhContentRoute } from "./src/gh-route";
|
||||
import { runGitToolsCommand } from "./src/git-tools";
|
||||
import { runCommanderCommand } from "./src/commander";
|
||||
@@ -282,6 +283,19 @@ async function main(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
if (top === "gh") {
|
||||
const result = withGhDefaultRendered(args.slice(1), await runGhCommand(args.slice(1)));
|
||||
const ok = (result as { ok?: unknown }).ok !== false;
|
||||
if (isRenderedCliResult(result)) {
|
||||
emitText(result.renderedText, result.command || commandName);
|
||||
if (!ok) process.exitCode = 1;
|
||||
return;
|
||||
}
|
||||
emitJson(commandName, result, ok);
|
||||
if (!ok) process.exitCode = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
const namespaceHelp = await staticNamespaceHelp(args);
|
||||
if (namespaceHelp !== null) {
|
||||
emitJson(commandName, namespaceHelp);
|
||||
@@ -318,19 +332,6 @@ async function main(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
if (top === "gh") {
|
||||
const result = await runGhCommand(args.slice(1));
|
||||
const ok = (result as { ok?: unknown }).ok !== false;
|
||||
if (isRenderedCliResult(result)) {
|
||||
emitText(result.renderedText, result.command || commandName);
|
||||
if (!ok) process.exitCode = 1;
|
||||
return;
|
||||
}
|
||||
emitJson(commandName, result, ok);
|
||||
if (!ok) process.exitCode = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (top === "git") {
|
||||
const result = runGitToolsCommand(args.slice(1));
|
||||
const ok = (result as { ok?: unknown }).ok !== false;
|
||||
|
||||
Reference in New Issue
Block a user