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

Multiple types including Boolean #16

Open
ryym opened this issue Mar 11, 2016 · 0 comments
Open

Multiple types including Boolean #16

ryym opened this issue Mar 11, 2016 · 0 comments

Comments

@ryym
Copy link

ryym commented Mar 11, 2016

Hi,

I run into an issue about an option of multiple types including Boolean.
When a command has an Boolean option, we can use it without values.

{
  options: [{
    option: 'foo',
    type: 'Boolean'
  }]
}
command
# => { _: [] }

command --foo true
# => { _: [], foo: true }

command --foo  ## no values
# => { _: [], foo: true }

But when the option has other types in addition to Boolean, we can't so.

{
  options: [{
    option: 'foo',
    type: 'Boolean | String'
  }]
}
command
# => { _: [] }

command --foo value
# => { _: [], foo: 'value' }

command --foo true
# => { _: [], foo: true }

command --foo
# => { _: [] }
## Expected: { _: [], foo: true }

Is it possible to use the option as a flag when values are omitted even if it has multiple types?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants