Skip to content

Commit f19dcb6

Browse files
committed
fix(cli): respect CP_VERBOSE if --verbose argument not given
1 parent 38ad415 commit f19dcb6

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

e2e/cli-e2e/tests/__snapshots__/help.e2e.test.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Commands:
1818
1919
2020
Global Options:
21-
--verbose When true creates more verbose output. This is helpful w
22-
hen debugging. You may also set CP_VERBOSE env variable
23-
instead. [boolean] [default: false]
21+
--verbose Toggles whether to print debug logs. The default value is de
22+
rived from the CP_VERBOSE environment variable (false if not
23+
set). [boolean]
2424
--config Path to config file. By default it loads code-pushup.con
2525
fig.(ts|mjs|js). [string]
2626
--tsconfig Path to a TypeScript config, to be used when loading con

packages/cli/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,11 @@ Each example is fully tested to demonstrate best practices for plugin testing as
195195

196196
### Global Options
197197

198-
| Option | Type | Default | Description |
199-
| ---------------- | --------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
200-
| **`--verbose`** | `boolean` | `false` | When true creates more verbose output. This is helpful when debugging. You may also set `CP_VERBOSE` env variable instead. |
201-
| **`--config`** | `string` | looks for `code-pushup.config.{ts\|mjs\|js}` | Path to config file. |
202-
| **`--tsconfig`** | `string` | n/a | Path to a TypeScript config, used to load config file. |
198+
| Option | Type | Default | Description |
199+
| ---------------- | --------- | ----------------------------------------------------- | ------------------------------------------------------ |
200+
| **`--verbose`** | `boolean` | `process.env['CP_VERBOSE']` if set, otherwise `false` | Toggles whether to print debug logs. |
201+
| **`--config`** | `string` | looks for `code-pushup.config.{ts\|mjs\|js}` | Path to config file. |
202+
| **`--tsconfig`** | `string` | n/a | Path to a TypeScript config, used to load config file. |
203203

204204
> [!NOTE]
205205
> By default, the CLI loads `code-pushup.config.(ts|mjs|js)` if no config path is provided with `--config`.

packages/cli/src/lib/implementation/global.options.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ export function yargsGlobalOptionsDefinition(): Record<
88
return {
99
verbose: {
1010
describe:
11-
'When true creates more verbose output. This is helpful when debugging. You may also set CP_VERBOSE env variable instead.',
11+
'Toggles whether to print debug logs. The default value is derived from the CP_VERBOSE environment variable (false if not set).',
1212
type: 'boolean',
13-
default: false,
1413
},
1514
config: {
1615
describe:

0 commit comments

Comments
 (0)