@silvery/commander 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/colorize.ts +3 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silvery/commander",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Colorized Commander.js help output using ANSI escape codes",
5
5
  "keywords": [
6
6
  "ansi",
@@ -10,7 +10,7 @@
10
10
  "help"
11
11
  ],
12
12
  "license": "MIT",
13
- "author": "Bjørn Stabell <bjorn@stabell.org>",
13
+ "author": "Bj\u00f8rn Stabell <bjorn@stabell.org>",
14
14
  "repository": {
15
15
  "type": "git",
16
16
  "url": "https://github.com/beorn/silvery.git",
package/src/colorize.ts CHANGED
@@ -67,11 +67,9 @@ export interface ColorizeHelpOptions {
67
67
  * @param options - Override default style functions for each element
68
68
  */
69
69
  export function colorizeHelp(program: CommandLike, options?: ColorizeHelpOptions): void {
70
- // Ensure style generates codes at minimum basic (ANSI 16).
71
- // Auto-detected level may be higher (256/truecolor) for richer output.
72
- // May be 0 if NO_COLOR is set; in that case, force basic since Commander
73
- // handles the final strip via configureOutput.
74
- if (s.level === 0) s.level = 1
70
+ // Respect NO_COLOR if the auto-detected level is 0, skip colorization entirely.
71
+ // The style instance already handles NO_COLOR/FORCE_COLOR/TERM detection.
72
+ if (s.level === 0) return
75
73
 
76
74
  // Semantic token fallback: theme token → named color
77
75
  const cmds = options?.commands ?? ((t: string) => s.primary(t))