Open w3irdrobot opened 8 years ago
I think right now this functionality is provided directly by the argParse library we use. It's possible it's an option you can customize. If it isn't an option though, I'd rather just accept this small difference over rolling our own command line parser (refactoring to another parser would be a pain, I'm not convinced this would be worth it)
I looked at the documentation for argparse and didn't see any options for help on no arguments. The .parse method throws an error that we could catch. Someone with more experience with argparse might be able to do it in a more elegant way.
If you look at the source for argparser, there is a method on it called printHelp
that I think will do the job. Super easy. More of a UX thing for the CLI. Not needed. More of a simple enhancement.
Yes, but capturing a no arguments event is the hard part.
In the CLI's main.js, at the bottom, we could add a default case that runs the help text.
This doesn't work because parser.parse
throws an error and exits when something isn't matched. Could we add a parser that catches no arguments?
hz
should probably display the help page (or help on how to display the help page) outside hz projects, but coming from Meteor, I expect it to act as a shorthand for hz serve
or hz serve --dev
otherwise.
refactoring to another parser would be a pain, I'm not convinced this would be worth it
Maybe I'm missing something, but refactoring to yargs should be pretty easy. The additional functionality, elimination of boilerplate code, and better formatting of help pages are definitely worth it. I wouldn't mind putting together a PR.
ping @Tryneus @dalanmiller for opinions
hz should probably display the help page (or help on how to display the help page) outside hz projects, but coming from Meteor, I expect it to act as a shorthand for hz serve or hz serve --dev otherwise.
Alternatively, allow folks to set their own default command in config.toml
. This would typically be a folder watcher that builds and serves on changes.
Many of the CLIs I use will print the help documentation when it is run with
-h
but also when it is run by itself. I'd like to implement this functionality. So if you runhz
, it will print out the same help text ashz -h
.I'm currently working with:
CLI version: 0.3.1 Client version: 0.1.0 Server version: 0.1.1-0