From 7da85ee32275c5e1b8a3ee6dd45b2c828f42c15a Mon Sep 17 00:00:00 2001 From: Canoa Date: Wed, 24 Jun 2026 21:00:07 +0100 Subject: [PATCH 1/4] add bunny colors to table head, and help overview --- packages/cli/src/core/define-namespace.ts | 9 +++++++-- packages/cli/src/core/format.ts | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/core/define-namespace.ts b/packages/cli/src/core/define-namespace.ts index ccf9c1a..bd2833f 100644 --- a/packages/cli/src/core/define-namespace.ts +++ b/packages/cli/src/core/define-namespace.ts @@ -1,5 +1,5 @@ import type { Argv, CommandModule } from "yargs"; - +import { bunny } from "../core/colors.ts"; /** * Groups subcommands under a parent namespace. Running the namespace * without a subcommand shows help. @@ -33,7 +33,12 @@ export function defineNamespace( return yargs; }, handler: () => { - yRef.showHelp("log"); + yRef.getHelp().then((helpText) => { + const colored = helpText + .replace(/^Commands:/m, bunny.bold("Commands:")) + .replace(/^Options:/m, bunny.bold("Options:")); + console.log(colored); + }); }, }; } diff --git a/packages/cli/src/core/format.ts b/packages/cli/src/core/format.ts index 74b18a4..a6131d6 100644 --- a/packages/cli/src/core/format.ts +++ b/packages/cli/src/core/format.ts @@ -1,6 +1,7 @@ import chalk from "chalk"; import Table from "cli-table3"; import type { OutputFormat } from "./types.ts"; +import { bunny } from "../core/colors.ts"; /** Resolve a date-like value to a `Date`, or `null` if invalid/missing. */ function toDate(value: Date | string | null | undefined): Date | null { @@ -95,7 +96,7 @@ export function formatTable( // text: borderless aligned columns with bold headers const table = new Table({ - head: headers.map((h) => chalk.bold(h)), + head: headers.map((h) => bunny.bold(h)), chars: { top: "", "top-mid": "", From 06e963a0b1ca2a86b2cbba91d1c4959b51c1246b Mon Sep 17 00:00:00 2001 From: Canoa Date: Wed, 24 Jun 2026 21:05:28 +0100 Subject: [PATCH 2/4] changeset --- .changeset/tall-suns-vanish.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tall-suns-vanish.md diff --git a/.changeset/tall-suns-vanish.md b/.changeset/tall-suns-vanish.md new file mode 100644 index 0000000..1d22564 --- /dev/null +++ b/.changeset/tall-suns-vanish.md @@ -0,0 +1,5 @@ +--- +"@bunny.net/cli": patch +--- + +Added bunny color to the table head and also the help overview. From 581cddf622d1dd3540ddb1a228c086384e2ac1c6 Mon Sep 17 00:00:00 2001 From: Canoa Date: Wed, 24 Jun 2026 21:12:02 +0100 Subject: [PATCH 3/4] fix order import order --- packages/cli/src/core/format.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/core/format.ts b/packages/cli/src/core/format.ts index a6131d6..84691cf 100644 --- a/packages/cli/src/core/format.ts +++ b/packages/cli/src/core/format.ts @@ -1,7 +1,7 @@ import chalk from "chalk"; import Table from "cli-table3"; -import type { OutputFormat } from "./types.ts"; import { bunny } from "../core/colors.ts"; +import type { OutputFormat } from "./types.ts"; /** Resolve a date-like value to a `Date`, or `null` if invalid/missing. */ function toDate(value: Date | string | null | undefined): Date | null { From 5c3ac81f82382e2495f318f239f2ec80752c98ef Mon Sep 17 00:00:00 2001 From: Canoa Date: Wed, 24 Jun 2026 21:32:13 +0100 Subject: [PATCH 4/4] resolve mentioned issues --- packages/cli/src/core/define-namespace.ts | 11 +++++++---- packages/cli/src/core/format.ts | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/core/define-namespace.ts b/packages/cli/src/core/define-namespace.ts index bd2833f..e7ba2b1 100644 --- a/packages/cli/src/core/define-namespace.ts +++ b/packages/cli/src/core/define-namespace.ts @@ -1,5 +1,5 @@ import type { Argv, CommandModule } from "yargs"; -import { bunny } from "../core/colors.ts"; +import { bunny } from "./colors.ts"; /** * Groups subcommands under a parent namespace. Running the namespace * without a subcommand shows help. @@ -32,13 +32,16 @@ export function defineNamespace( for (const sub of subcommands) yargs.command(sub); return yargs; }, - handler: () => { - yRef.getHelp().then((helpText) => { + handler: async () => { + try { + const helpText = await yRef.getHelp(); const colored = helpText .replace(/^Commands:/m, bunny.bold("Commands:")) .replace(/^Options:/m, bunny.bold("Options:")); console.log(colored); - }); + } catch (err) { + console.error("Failed to load help text:", err); + } }, }; } diff --git a/packages/cli/src/core/format.ts b/packages/cli/src/core/format.ts index 84691cf..c1bf78e 100644 --- a/packages/cli/src/core/format.ts +++ b/packages/cli/src/core/format.ts @@ -1,6 +1,6 @@ import chalk from "chalk"; import Table from "cli-table3"; -import { bunny } from "../core/colors.ts"; +import { bunny } from "./colors.ts"; import type { OutputFormat } from "./types.ts"; /** Resolve a date-like value to a `Date`, or `null` if invalid/missing. */