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

Feature request - looking for enum #33

Open
ORESoftware opened this issue Feb 25, 2017 · 2 comments
Open

Feature request - looking for enum #33

ORESoftware opened this issue Feb 25, 2017 · 2 comments

Comments

@ORESoftware
Copy link
Contributor

ORESoftware commented Feb 25, 2017

Here are all options for an argument (as listed in docs):

{
    names: ['file', 'f'],       // Required (one of `names` or `name`).
    type: 'string',             // Required.
    completionType: 'filename',
    env: 'MYTOOL_FILE',
    help: 'Config file to load before running "mytool"',
    helpArg: 'PATH',
    helpWrap: false,
    default: path.resolve(process.env.HOME, '.mytoolrc')
}

I am looking for an enum option, so I can use it like so:

{
  names: ['signal','s']
  type: 'string',
  enum: ['SIGINT', 'SIGTERM', 'SIGKILL']     // <<<<<<<< here
}

I can handle that in my code, but it would be nice if dashdash could do that!

thanks

@ORESoftware
Copy link
Contributor Author

bump @trentm

@karfau
Copy link

karfau commented Jan 31, 2020

This should be easy to add when needed by adding a custom type:
https://github.com/trentm/node-dashdash#custom-option-types

There is even an example how to do this:
https://github.com/trentm/node-dashdash/blob/master/examples/custom-option-fruit.js

So the library is extensible enough, to allow this behavior.
It doesn't really need to be added as part of it.

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

2 participants