Skip to content

Commit 5d3c1ec

Browse files
committed
fix(oak): detect terminal width instead of hardcoding 120
Use process.stdout.columns with fallback to 80 for help output width.
1 parent d365a61 commit 5d3c1ec

File tree

6 files changed

+232
-191
lines changed

6 files changed

+232
-191
lines changed

src/oak/Help/Help.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ export const render = (parameters_: Parameter[], settings: Settings.Output, _set
7575
)
7676
}
7777

78-
// Explicitly set terminal width for deterministic rendering (kit 0.87.0+)
79-
// Global read happens at module load time, not per-render
80-
// Child blocks can safely specify partial spanRange (kit #36 fixed)
81-
const HELP_TERMINAL_WIDTH = 120
78+
const HELP_TERMINAL_WIDTH = process.stdout?.columns ?? 80
8279
const output = Cli.Tex.Tex({ terminalWidth: HELP_TERMINAL_WIDTH })
8380
.block(($) => {
8481
if (!settings.description) return null

src/oak/__tests/environment/__snapshots__/parsing.spec.ts.snap

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ PARAMETERS
2020
 
2121
NOTES
2222
━━━━━
23-
(1) Parameters can be passed arguments via environment variables. Command line arguments take precedence. Environment
24-
 variable names are snake cased versions of the parameter name (or its aliases), case insensitive. They must be 
25-
 prefixed with CLI_PARAMETER_ or CLI_PARAM_ (case insensitive). Examples: 
26-
 → CLI_PARAMETER_FOO="..." 
23+
(1) Parameters can be passed arguments via environment variables. Command line 
24+
 arguments take precedence. Environment variable names are snake cased 
25+
 versions of the parameter name (or its aliases), case insensitive. They must
26+
 be prefixed with CLI_PARAMETER_ or CLI_PARAM_ (case insensitive). Examples: 
27+
 → CLI_PARAMETER_FOO="..." 
2728
",
2829
],
2930
]

src/oak/__tests/environment/global/__snapshots__/prefix.spec.ts.snap

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ PARAMETERS
1919
 
2020
NOTES
2121
━━━━━
22-
(1) Parameters can be passed arguments via environment variables. Command line arguments take precedence. Environment
23-
 variable names are snake cased versions of the parameter name (or its aliases), case insensitive. They must be 
24-
 prefixed with CLI_PARAMETER_ or CLI_PARAM_ (case insensitive). Examples: 
25-
 → CLI_PARAMETER_FOO="..." 
22+
(1) Parameters can be passed arguments via environment variables. Command line 
23+
 arguments take precedence. Environment variable names are snake cased 
24+
 versions of the parameter name (or its aliases), case insensitive. They must
25+
 be prefixed with CLI_PARAMETER_ or CLI_PARAM_ (case insensitive). Examples: 
26+
 → CLI_PARAMETER_FOO="..." 
2627
",
2728
],
2829
]
@@ -50,11 +51,12 @@ PARAMETERS
5051
 
5152
NOTES
5253
━━━━━
53-
(1) Parameters can be passed arguments via environment variables. Command line arguments take precedence. Environment
54-
 variable names are snake cased versions of the parameter name (or its aliases), case insensitive. They must be 
55-
 prefixed with CLI_PARAMETER_ or CLI_PARAM_ (case insensitive). Examples: 
56-
 → CLI_PARAMETER_BAR="..." 
57-
 → CLI_PARAMETER_FOO="..." 
54+
(1) Parameters can be passed arguments via environment variables. Command line 
55+
 arguments take precedence. Environment variable names are snake cased 
56+
 versions of the parameter name (or its aliases), case insensitive. They must
57+
 be prefixed with CLI_PARAMETER_ or CLI_PARAM_ (case insensitive). Examples: 
58+
 → CLI_PARAMETER_BAR="..." 
59+
 → CLI_PARAMETER_FOO="..." 
5860
",
5961
],
6062
]
@@ -79,10 +81,11 @@ PARAMETERS
7981
 
8082
NOTES
8183
━━━━━
82-
(1) Parameters can be passed arguments via environment variables. Command line arguments take precedence. Environment
83-
 variable names are snake cased versions of the parameter name (or its aliases), case insensitive. They must be 
84-
 prefixed with CLI_PARAMETER_ or CLI_PARAM_ (case insensitive). Examples: 
85-
 → CLI_PARAMETER_FOO="..." 
84+
(1) Parameters can be passed arguments via environment variables. Command line 
85+
 arguments take precedence. Environment variable names are snake cased 
86+
 versions of the parameter name (or its aliases), case insensitive. They must
87+
 be prefixed with CLI_PARAMETER_ or CLI_PARAM_ (case insensitive). Examples: 
88+
 → CLI_PARAMETER_FOO="..." 
8689
",
8790
],
8891
]

0 commit comments

Comments
 (0)