4 ms·
The choice of not writing options parser was very deliberate. As much as it is a tempting proposition I believe there are already great tools around. TTY attemp
by pmurach 10y ago
The choice of not writing options parser was very deliberate. As much as it is a tempting proposition I believe there are already great tools around. TTY attempts to provide glue to stitch a lot of scripting needs together without opinionated view on how they should be structured - for now at least ;-)
In my scripting experience I tend to gravitate towards two solutions. If my script is fairly small, e.i. in a single file, with no much complexity I tend to use Ruby standard library optparse. However, if my needs get a bit more complex and I need, for example, subcommands I use thor. Thor gives me a better way to structure my application logic. These two solutions so far have covered all my needs.
Other solutions that I've played in the past are:
* main - very sweet DSL (https://github.com/ahoward/main https://github.com/ahoward/main)
* clamp - (https://github.com/mdub/clamp https://github.com/mdub/clamp)
* slop - (https://github.com/leejarvis/slop https://github.com/leejarvis/slop)
* gli - for Git-like interfaces (https://github.com/davetron5000/gli https://github.com/davetron5000/gli)
My recommendation before using other libraries would be to really give optparse a good spin so that you can figure out why the other options are more suitable.