fix(cli): show option descriptions in help output and move verify under config
This commit is contained in:
parent
6588fad461
commit
177c724fdf
4 changed files with 11 additions and 5 deletions
|
|
@ -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("");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ export const commandRegistry = {
|
|||
subcommands: {
|
||||
init: configInit.commandConfig,
|
||||
view: configView.commandConfig,
|
||||
verify: verify.commandConfig,
|
||||
},
|
||||
},
|
||||
verify: verify.commandConfig,
|
||||
};
|
||||
|
|
@ -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,
|
||||
};
|
||||
|
|
@ -44,7 +44,7 @@ export async function checkForgejoReachability(
|
|||
}
|
||||
}
|
||||
|
||||
export async function checkForgejoApi(
|
||||
export async function checkForgejoApiAuthentication(
|
||||
baseUrl: string,
|
||||
pat: string,
|
||||
colorize = false,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue