We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keywords: options, alias, aliases, hyphen, kebab-case
Long hyphenated options (e.g. --clear-screen) aren't recognised as aliases of short options (e.g. -c) or long non-hyphenated options (e.g. --clear).
--clear-screen
-c
--clear
Suppose you have a --clear-screen option (as in the README) which can also be called as --clear or -c:
cat ./test.js
const cli = require('cac')() cli.option('-c, --clear, --clear-screen') console.log(cli.parse().options)
If this command is called with -c or --clear (or --clearScreen), all three aliases are assigned the value, e.g.:
--clearScreen
node ./test.js -c # { '--': [], c: true, clear: true, clearScreen: true } node ./test.js --clear # { '--': [], c: true, clear: true, clearScreen: true } node ./test.js --clearScreen # { '--': [], c: true, clear: true, clearScreen: true }
But if the command is called with the long hyphenated option, it's treated as an unknown option (the aliases are not assigned the value):
node ./test.js --clear-screen # { '--': [], clearScreen: true } node ./test.js --unknown-option # { '--': [], unknownOption: true }
CAC: 6.7.3 Node: v14.17.3 OS: Linux (Arch)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Issue Type
Keywords: options, alias, aliases, hyphen, kebab-case
Description
Long hyphenated options (e.g.
--clear-screen
) aren't recognised as aliases of short options (e.g.-c
) or long non-hyphenated options (e.g.--clear
).Suppose you have a
--clear-screen
option (as in the README) which can also be called as--clear
or-c
:If this command is called with
-c
or--clear
(or--clearScreen
), all three aliases are assigned the value, e.g.:But if the command is called with the long hyphenated option, it's treated as an unknown option (the aliases are not assigned the value):
Environment
CAC: 6.7.3
Node: v14.17.3
OS: Linux (Arch)
The text was updated successfully, but these errors were encountered: