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

[Bug Report] Multiple words negated options #61

Closed
1 of 3 tasks
meteorlxy opened this issue Jan 13, 2020 · 4 comments · Fixed by #62
Closed
1 of 3 tasks

[Bug Report] Multiple words negated options #61

meteorlxy opened this issue Jan 13, 2020 · 4 comments · Fixed by #62
Labels

Comments

@meteorlxy
Copy link
Contributor

Issue Type

  • Bug Report
  • Feature Request
  • Other

Steps to repro

// test.js
const cli = require('cac')();

cli.option('--no-aaa-bbb').option('--no-ccc');

const parsed = cli.parse();

console.log(JSON.stringify(parsed, null, 2));
$ node test.js
{
  "args": [],
  "options": {
    "--": [],
    "aaa-bbb": true,
    "ccc": true
  }
}

$ node test.js --no-aaa-bbb
{
  "args": [],
  "options": {
    "--": [],
    "aaa-bbb": true,
    "ccc": true,
    "aaaBbb": false
  }
}

$ node test.js --no-ccc
{
  "args": [],
  "options": {
    "--": [],
    "aaa-bbb": true,
    "ccc": false
  }
}

The "aaa-bbb": true is always there.

Info

  • CAC version: 6.5.3
@egoist
Copy link
Collaborator

egoist commented Jan 13, 2020

I updated the docs for this: https://github.com/cacjs/cac#dash-in-option-names

Maybe we should delete the options['foo-bar'] to reduce confusion

@meteorlxy
Copy link
Contributor Author

Well, the point is that:

  • options without dash have default value true
  • options with dash have default value undefined

They are inconsistent

@egoist
Copy link
Collaborator

egoist commented Jan 13, 2020

I see, I'll fix it.

@egoist
Copy link
Collaborator

egoist commented Jan 13, 2020

🎉 This issue has been resolved in version 6.5.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

2 participants