`allowUnknownFlags: false` prevents aliases for `help` and `version`.
melusc opened this issue · comments
Luca commented
When setting allowUnknownFlags
to false
it now overrides the options for the help
and version
flags. As seen here https://github.com/sindresorhus/meow/pull/215/files#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346R150-R160 and released in v10.1.4
.
I have something like this to allow -h
for --help
and -v
for --version
meow(
`...`,
{
importMeta: import.meta,
flags: {
help: {
alias: 'h',
type: 'boolean',
},
version: {
alias: 'v',
type: 'boolean',
},
},
allowUnknownFlags: false,
},
)
but now -h
and -v
are treated as unknown flags.
$ node ./dist/index.js -v
Unknown flag
-v
Sindre Sorhus commented
// @bartaz
Luca commented
I'm not familiar with the code but I was thinking something like
parserOptions.help = {...parserOptions.help, type: 'boolean'};
// or
parserOptions.help ??= {type: 'boolean'};
Bartek Szopka commented