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

Improve handling of command line arguments #64

Closed
tpluscode opened this issue Jan 15, 2017 · 3 comments
Closed

Improve handling of command line arguments #64

tpluscode opened this issue Jan 15, 2017 · 3 comments
Assignees
Labels

Comments

@tpluscode
Copy link
Contributor

First of all, I see that the argument names style changed from kebab to camel?

--out-dir -> --outDir

I prefer kebab but that's beside the point.

The real issue is that when I give twc an invalid parameter (such as the previously valid --out-dir), the process still proceeds. IMO it should fail and display a message that there was an invalid parameter. Otherwise the result may be surprising.

Are you parsing the arguments manually? I don't know about node, but maybe you could use some kind of library to simplify reading, parsing and validating input parameters? Such lib would likely also generate the help text automatically.

@Buslowicz
Copy link
Owner

I moved to camelCase to make it closer to tsc options.
As for lib, I'm using commander, see the cli.ts file to check how is it done. Don't know if there is an option to fail on incorrect options. I'll give it a read and if possible I'll throw that error. If it's not provided by commander, I'll try doing it manually or will replace commander with something else.

@tpluscode
Copy link
Contributor Author

This is not yet supported apparently: tj/commander.js#482

This looks like a viable alternative: https://www.npmjs.com/package/command-line-args

@Buslowicz
Copy link
Owner

Affirmative. I will take a look into it and make sure it throws an error when incorrect option is passed (using lib you mentioned if it has all the other features).

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

No branches or pull requests

2 participants