File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " @bunny.net/cli " : patch
3+ ---
4+
5+ Added bunny color to the table head and also the help overview.
Original file line number Diff line number Diff line change 11import type { Argv , CommandModule } from "yargs" ;
2-
2+ import { bunny } from "./colors.ts" ;
33/**
44 * Groups subcommands under a parent namespace. Running the namespace
55 * without a subcommand shows help.
@@ -32,8 +32,16 @@ export function defineNamespace(
3232 for ( const sub of subcommands ) yargs . command ( sub ) ;
3333 return yargs ;
3434 } ,
35- handler : ( ) => {
36- yRef . showHelp ( "log" ) ;
35+ handler : async ( ) => {
36+ try {
37+ const helpText = await yRef . getHelp ( ) ;
38+ const colored = helpText
39+ . replace ( / ^ C o m m a n d s : / m, bunny . bold ( "Commands:" ) )
40+ . replace ( / ^ O p t i o n s : / m, bunny . bold ( "Options:" ) ) ;
41+ console . log ( colored ) ;
42+ } catch ( err ) {
43+ console . error ( "Failed to load help text:" , err ) ;
44+ }
3745 } ,
3846 } ;
3947}
Original file line number Diff line number Diff line change 11import chalk from "chalk" ;
22import Table from "cli-table3" ;
3+ import { bunny } from "./colors.ts" ;
34import type { OutputFormat } from "./types.ts" ;
45
56/** Resolve a date-like value to a `Date`, or `null` if invalid/missing. */
@@ -95,7 +96,7 @@ export function formatTable(
9596
9697 // text: borderless aligned columns with bold headers
9798 const table = new Table ( {
98- head : headers . map ( ( h ) => chalk . bold ( h ) ) ,
99+ head : headers . map ( ( h ) => bunny . bold ( h ) ) ,
99100 chars : {
100101 top : "" ,
101102 "top-mid" : "" ,
You can’t perform that action at this time.
0 commit comments