Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tall-suns-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bunny.net/cli": patch
---

Added bunny color to the table head and also the help overview.
14 changes: 11 additions & 3 deletions packages/cli/src/core/define-namespace.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Argv, CommandModule } from "yargs";

import { bunny } from "./colors.ts";
/**
* Groups subcommands under a parent namespace. Running the namespace
* without a subcommand shows help.
Expand Down Expand Up @@ -32,8 +32,16 @@ export function defineNamespace(
for (const sub of subcommands) yargs.command(sub);
return yargs;
},
handler: () => {
yRef.showHelp("log");
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);
}
},
};
}
3 changes: 2 additions & 1 deletion packages/cli/src/core/format.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import chalk from "chalk";
import Table from "cli-table3";
import { bunny } from "./colors.ts";
import type { OutputFormat } from "./types.ts";

/** Resolve a date-like value to a `Date`, or `null` if invalid/missing. */
Expand Down Expand Up @@ -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": "",
Expand Down