could I use default command(not the global one with name '@@global@@')?
richardo2016 opened this issue · 1 comments
richardo2016 commented
Issue Type
- Bug Report
- Feature Request
- Other
run code below:
cli.command('[...rest]', 'desc')
.option('--out', 'desc')
.action(...)
const parsed = cli.parse(['', '', './src', '--out', './lib'], { run: false});
console.log(parsed)
Expected
{
"args": [
"./src",
"abc"
],
"options": {
"--": [],
"out": "./lib"
}
}
Actual
{
"args": [
"./src"
],
"options": {
"--": [],
"out": true
}
}
Possible Solutions
Info
- CAC version: 6.7.x
- Reproduction link:
richardo2016 commented
finally I found I should customize option like this:
cli.command('[...rest]', 'desc')
.option('--out [out]', 'desc') // add one option var name with bracket here 🤔
.action(...)
const parsed = cli.parse(['', '', './src', '--out', './lib'], { run: false});
console.log(parsed)
then cli.parse
works as I expected.