Skip to content
New issue

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

alias for options #479

Closed
dashmug opened this issue Dec 18, 2015 · 4 comments
Closed

alias for options #479

dashmug opened this issue Dec 18, 2015 · 4 comments

Comments

@dashmug
Copy link

dashmug commented Dec 18, 2015

Is it possible to use add aliases to options?

e.g.

program
  .version('0.0.1')
  .option('-T, --no-tests, --notests', 'ignore test hook')

to support both --no-tests and --notests?

@zhiyelee
Copy link
Collaborator

Unfortunately, we can't now. Only have alias for command now.

PR is welcome for this. Thanks

@shadowspawn
Copy link
Collaborator

This issue has not received many reactions or links, and has not had any activity in over six months. It isn't likely to get acted on due to this report.

Feel free to open a new issue if it comes up again, with new information and renewed interest.

Thank you for your contributions.

@glensc
Copy link

glensc commented Dec 27, 2021

I was trying to figure out does this work, unfortunately it looks like this is supported (no errors) from help, but really the option does not work

➔ ./bin/console.ts push all --help
Usage: console push [options] <worker>

Invoke push for worker

Options:
  -v, --verbose                                Increase verbosity
  --limit <limit>                              Limit to <limit> iterations
  -f, --start-date <date>, --date-from <date>  Specify start date (default: "now")
  -t, --end-date <date>, --date-to <date>      Specify end date (default: "now")
  --id <articleId>                             Submit only these articles (default: [])
  -h, --help                                   display help for command

➔ ./bin/console.ts push all --date-from 'yesterday'
error: unknown option '--date-from'

@shadowspawn
Copy link
Collaborator

Commander supports a short option, a long option, or both. Commander does not support multiple short options or multiple long options. And does not currently have any error checking logic in the Option constructor, so no error message.

Support for a lone short option was added in Commander 6: #1256

jwartofsky-yext added a commit to yext/pages that referenced this issue Jul 13, 2023
Commander expects -- before option names for long command names.

It also does not support multiple long option names, like
"--local" and "--noGenTestData"

tj/commander.js#479
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants