mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 01:54:49 +00:00
Adapt the forwarding proposal in #4652 with a required signal before optional resource diagnostics. Migrate all callers and cover actual command registration during final close. Refs #4939. Co-authored-by: Tapraj-Pathak <165466587+Tapraj-Pathak@users.noreply.github.com>
41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
import { z } from "incur";
|
|
import { createGoBinaryService } from "../composition/go.js";
|
|
import { CLI_COMMANDS } from "../cliCommandNames.js";
|
|
import { logCliCommand } from "../cliLogging.js";
|
|
import type { Logger } from "pino";
|
|
import type { CliInstance } from "./types.js";
|
|
import { withCommandCancellation } from "./commandCancellation.js";
|
|
import { finishAnalysisCommand } from "./finishAnalysisCommand.js";
|
|
import { absoluteCallerPath } from "../filesystem/callerPath.js";
|
|
|
|
/** Resolve caller paths and inspect static build metadata through the shared workflow. */
|
|
export const registerGoCommands = (cli: CliInstance, logger: Logger): void => {
|
|
cli.command(CLI_COMMANDS.inspectGoBinary, {
|
|
description:
|
|
"Inspect embedded Go compiler, modules and build settings without target execution",
|
|
args: z.object({
|
|
path: z.string().describe("Local ELF, PE or thin Mach-O image"),
|
|
}),
|
|
run: ({ args }) =>
|
|
withCommandCancellation(async (signal) => {
|
|
const service = createGoBinaryService();
|
|
return await logCliCommand(
|
|
logger,
|
|
CLI_COMMANDS.inspectGoBinary,
|
|
async () =>
|
|
finishAnalysisCommand(
|
|
() =>
|
|
service.inspect(
|
|
{ path: absoluteCallerPath(args.path) },
|
|
{ signal },
|
|
),
|
|
service,
|
|
"go-build-info",
|
|
"inspect_go_binary",
|
|
signal,
|
|
),
|
|
);
|
|
}),
|
|
});
|
|
};
|