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

consider using something else instead of commander #3037

Closed
boneskull opened this issue Sep 29, 2017 · 5 comments
Closed

consider using something else instead of commander #3037

boneskull opened this issue Sep 29, 2017 · 5 comments
Labels
nice to have enhancement proposal of low priority semver-minor implementation requires increase of "minor" version number; "features" type: chore generally involving deps, tooling, configuration, etc.

Comments

@boneskull
Copy link
Contributor

there are a couple problems with commander:

  • the upgrade from 2.9.x to 2.11.x introduced breaking changes
  • we're fiddling with commander's internals in at least one place in bin/_mocha
  • no out-of-box support for passing node flags

Ideally whatever module we consume instead should adhere more strictly to semver and allow us to consolidate the executables in bin/.

@boneskull boneskull added type: chore generally involving deps, tooling, configuration, etc. nice to have enhancement proposal of low priority semver-minor implementation requires increase of "minor" version number; "features" labels Sep 29, 2017
@Bamieh
Copy link
Contributor

Bamieh commented Dec 18, 2017

I suggest we look into yargs

@ORESoftware
Copy link

ORESoftware commented Dec 18, 2017

dashdash is solid -
https://github.com/trentm/node-dashdash

to pass exec flags, I think it's fine to just to do this:

mocha --exec-flag="--inspect-brk" --exec-flag="--harmony"

maybe not the least verbose tho

also, there is NODE_OPTIONS:

NODE_OPTIONS="--inspect-brk --harmony" mocha

I think NODE_OPTIONS has been backported to Node.js version 6, if I am not mistaken

@boneskull
Copy link
Contributor Author

boneskull commented Dec 18, 2017

NODE_OPTIONS is cool, for sure, but people will complain about environment variables. may be a worth the tradeoff, especially if we couple a solution with #2292

dashdash seems pretty powerful, but I haven't used it. I'm familiar with yargs. Also I think liftoff might help with this sort of thing

@boneskull
Copy link
Contributor Author

See nodejs/node#17740

@Alhadis
Copy link
Contributor

Alhadis commented Aug 14, 2018

If a low-level, hands-on approach is needed, you can try get-options. It makes a point of being reliable, explicit, and providing maximal control over argument handling. It's particularly good at handling bundled switches, even those with parameters attached.

The trade-off is that it leaves validation and auto-generated help messages to the author, and doesn't even assume it's running in a Node environment (e.g., it'll work fine in browsers). Naturally, this means no special handling of NODE_OPTIONS, but that can also be parsed into an array never mind, I still need to implement that...

Understandably, the library won't be to everyone's tastes. I wrote it because commander was trying to do too damn MUCH and I coveted something that gave developers more control. But yeah, YMMV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nice to have enhancement proposal of low priority semver-minor implementation requires increase of "minor" version number; "features" type: chore generally involving deps, tooling, configuration, etc.
Projects
None yet
Development

No branches or pull requests

4 participants