cac
cac copied to clipboard
When we have field `choices` of `option`, we have to give flag one precise value
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
Oh I think it should pass when the flag value is undefined unless require: true is set, PR welcome for fixes 😅