fix(cli): show option descriptions in help output and move verify under config

This commit is contained in:
ZTatman 2026-04-12 23:07:34 -04:00
parent 6588fad461
commit 177c724fdf
4 changed files with 11 additions and 5 deletions

View file

@ -8,6 +8,7 @@ interface OptionSpec {
type: "string" | "boolean";
short?: string;
default?: string | boolean | string[] | boolean[];
description?: string;
}
type OptionsSpec = Record<string, OptionSpec>;
@ -117,9 +118,10 @@ function showCommandHelp(
for (const [optName, optSpec] of Object.entries(targetConf.options)) {
const short = optSpec.short ? `, -${optSpec.short}` : "";
const typeHint = optSpec.type === "string" ? " <value>" : "";
const desc = optSpec.description ?? "";
optionRows.push({
name: `--${optName}${short}${typeHint}`,
desc: "",
desc,
});
}
@ -128,7 +130,11 @@ function showCommandHelp(
lines.push(c.bold("Options:"));
for (const row of optionRows) {
lines.push(`${INDENT}${row.name.padEnd(colWidth)}`);
if (row.desc) {
lines.push(`${INDENT}${row.name.padEnd(colWidth)}${c.dim(row.desc)}`);
} else {
lines.push(`${INDENT}${row.name}`);
}
}
lines.push("");
}

View file

@ -8,7 +8,7 @@ export const commandRegistry = {
subcommands: {
init: configInit.commandConfig,
view: configView.commandConfig,
verify: verify.commandConfig,
},
},
verify: verify.commandConfig,
};

View file

@ -214,7 +214,7 @@ async function verifyResults(
export const commandConfig: CommandConfig = {
description: "Verify Myst configuration and connection to Forgejo",
options: {
diagnostic: { type: "boolean" },
diagnostic: { type: "boolean", description: "Show diagnostic information for all checks" },
},
handler: verifyCommand,
};

View file

@ -44,7 +44,7 @@ export async function checkForgejoReachability(
}
}
export async function checkForgejoApi(
export async function checkForgejoApiAuthentication(
baseUrl: string,
pat: string,
colorize = false,