-
Notifications
You must be signed in to change notification settings - Fork 621
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
std/flags should be able to provide "--help" usage information #1586
Comments
Sounds like a good idea and it would be a nice addition! PRs are welcome. |
Just to connect the idea: I think it would be very good to have a |
That sounds good to me too, again PRs are welcome! |
My vote would be for scoping this to just argument parsing, commands, and usage info. In other words, for non-interactive command line interfaces. (I thought commander was also scoped this way, but I could be wrong.) Redrawing, progress bars, etc. are often handled separately in other languages (e.g. popt vs curses in C). If you think both should be grouped together, I've heard the "cliffy" module might be a good start (though I've never used it). |
Not sure how I missed this the first time I looked, but someone already created a commander-like module for Deno: https://github.com/siokas/denomander I haven't tried it out yet, but it sounds promising. |
@bartlomieju @kt3k Could you clarify so I can get started? Thx! |
Btw, in my opinion the ideal scope would be maybe improving the current implementation, but keeping it simple. Just argument, option parsing, defaults, help generation etc in a nicely organised API, like commander. Anyway, please let me know what you think. I'm happy to work on anything related to this. Just let's decide the scope. |
@bartlomieju @kt3k |
@gtamas |
@kt3k But I still don't understand what's the long term goal. Do you wish the "flags" module to be a highly advanced CLI parser / API someday or do you want to keep the current minimalist approach? A major API refact would require a proper proposal. I'm happy to work that too. |
If the change doesn't include breaking changes, we probably can land those changes.
I think there's no fixed long term goal about But because yargs now officially supports deno https://github.com/yargs/yargs#deno, and there's also a good CLI framework cliffy, I personally guess the demand of such feature-rich CLI tools are now a little low in the community (but that doesn't prevent people from working on this area |
Is your feature request related to a problem? Please describe.
Deno's std/flags module can parse command line arguments, but a complete command line interface should also be self-documenting, e.g. by printing out usage information when "--help" is specified. Currently, there doesn't appear to be anything in the standard library for producing usage information.
Describe the solution you'd like
My personal preference would be to extend the existing std/flags module to support optionally generating usage information on "--help". I created a prototype module here: x/flags_usage (note: I'm not claiming this is the ideal solution; it just does what I want and has reasonable default behavior on the interfaces I've tested it on).
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: