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

When we have field choices of option, we have to give flag one precise value #26

Open
Gnosnay opened this issue Sep 6, 2018 · 1 comment
Labels
v3 CAC v3

Comments

@Gnosnay
Copy link

Gnosnay commented Sep 6, 2018

When we have field choices of option, we have to give flag one precise value.

const cac = require('../')

const cli = cac()

cli.command('a', {
  desc: 'command a',
}).option('foo', {
  desc: 'foo is a flag for command a'.
  type: "string",
  default: "aa", 
  choices: ["aa", "bb", "cc"]
})

We have to give the value to flag of foo. like that:

$ cli a
# error msg
The value of flag "foo" should be one of: "aa","bb","cc"
$ cli a --foo aa
# pass
@egoist
Copy link
Collaborator

egoist commented Sep 6, 2018

Oh I think it should pass when the flag value is undefined unless require: true is set, PR welcome for fixes 😅

@egoist egoist added the v3 CAC v3 label Dec 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3 CAC v3
Projects
None yet
Development

No branches or pull requests

2 participants