Skip to content

Commit 4718db3

Browse files
committed
fix(cli): Accept warning as hidden log-level alias
Preserve backwards compatibility for existing scripts that pass --log-level warning while keeping help output focused on the internal warn level token. Map warning to warn during argument coercion in both the main and lightweight yargs app builders so init/setup and normal CLI execution behave consistently.
1 parent 914a980 commit 4718db3

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/cli.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ async function buildLightweightYargsApp(): Promise<ReturnType<typeof import('yar
4949
type: 'string',
5050
describe: 'Set log verbosity level',
5151
choices: ['none', 'error', 'warn', 'info', 'debug'] as const,
52+
coerce: (value: unknown) => {
53+
if (typeof value !== 'string') return value;
54+
return value.trim().toLowerCase() === 'warning' ? 'warn' : value;
55+
},
5256
default: 'none',
5357
})
5458
.option('style', {

src/cli/yargs-app.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ export function buildYargsApp(opts: YargsAppOptions): ReturnType<typeof yargs> {
4545
type: 'string',
4646
describe: 'Set log verbosity level',
4747
choices: ['none', 'error', 'warn', 'info', 'debug'] as const,
48+
coerce: (value: unknown) => {
49+
if (typeof value !== 'string') return value;
50+
return value.trim().toLowerCase() === 'warning' ? 'warn' : value;
51+
},
4852
default: 'none',
4953
})
5054
.option('style', {

0 commit comments

Comments
 (0)