CLI: add config path subcommand to print active config file path (#26256)

Merged via squash.

Prepared head SHA: b11c593a34c5730f4244c054e1d1ab536953b0ef
Co-authored-by: cyb1278588254 <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
This commit is contained in:
cyb1278588254
2026-03-01 23:33:20 -05:00
committed by GitHub
co-authored by gumadeiras
parent dc2290aeb1
commit 96ffbb5aaf
6 changed files with 54 additions and 5 deletions
+19 -1
View File
@@ -324,11 +324,22 @@ export async function runConfigUnset(opts: { path: string; runtime?: RuntimeEnv
}
}
export async function runConfigFile(opts: { runtime?: RuntimeEnv }) {
const runtime = opts.runtime ?? defaultRuntime;
try {
const snapshot = await readConfigFileSnapshot();
runtime.log(shortenHomePath(snapshot.path));
} catch (err) {
runtime.error(danger(String(err)));
runtime.exit(1);
}
}
export function registerConfigCli(program: Command) {
const cmd = program
.command("config")
.description(
"Non-interactive config helpers (get/set/unset). Run without subcommand for the setup wizard.",
"Non-interactive config helpers (get/set/unset/file). Run without subcommand for the setup wizard.",
)
.addHelpText(
"after",
@@ -390,4 +401,11 @@ export function registerConfigCli(program: Command) {
.action(async (path: string) => {
await runConfigUnset({ path });
});
cmd
.command("file")
.description("Print the active config file path")
.action(async () => {
await runConfigFile({});
});
}