From 177c724fdfb2240fd985a947f100ef2008f7d53f Mon Sep 17 00:00:00 2001 From: ZTatman Date: Sun, 12 Apr 2026 23:07:34 -0400 Subject: [PATCH] fix(cli): show option descriptions in help output and move verify under config --- packages/cli/src/cli-router.ts | 10 ++++++++-- packages/cli/src/commandRegistry.ts | 2 +- packages/cli/src/commands/verify.ts | 2 +- packages/cli/src/utils/forgejo-checks.ts | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/cli-router.ts b/packages/cli/src/cli-router.ts index d00e4ea..e064cec 100644 --- a/packages/cli/src/cli-router.ts +++ b/packages/cli/src/cli-router.ts @@ -8,6 +8,7 @@ interface OptionSpec { type: "string" | "boolean"; short?: string; default?: string | boolean | string[] | boolean[]; + description?: string; } type OptionsSpec = Record; @@ -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" ? " " : ""; + 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(""); } diff --git a/packages/cli/src/commandRegistry.ts b/packages/cli/src/commandRegistry.ts index 5b5cc44..9c89061 100644 --- a/packages/cli/src/commandRegistry.ts +++ b/packages/cli/src/commandRegistry.ts @@ -8,7 +8,7 @@ export const commandRegistry = { subcommands: { init: configInit.commandConfig, view: configView.commandConfig, + verify: verify.commandConfig, }, }, - verify: verify.commandConfig, }; \ No newline at end of file diff --git a/packages/cli/src/commands/verify.ts b/packages/cli/src/commands/verify.ts index 3833940..018d8fb 100644 --- a/packages/cli/src/commands/verify.ts +++ b/packages/cli/src/commands/verify.ts @@ -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, }; \ No newline at end of file diff --git a/packages/cli/src/utils/forgejo-checks.ts b/packages/cli/src/utils/forgejo-checks.ts index 4982941..f400b41 100644 --- a/packages/cli/src/utils/forgejo-checks.ts +++ b/packages/cli/src/utils/forgejo-checks.ts @@ -44,7 +44,7 @@ export async function checkForgejoReachability( } } -export async function checkForgejoApi( +export async function checkForgejoApiAuthentication( baseUrl: string, pat: string, colorize = false,