I've recently started using thor. I've set my script up with some global options, such as -l
--logging
and -v开发者_开发问答
--verbose
. I'd like users to be able to call my thor task with -lv
rather than -l -v
, but this doesn't seem possible.
There are several items in the standard library and should help you support Unixy flags/command-line arguments:
getoptlong is reminiscent of Perl's GetOpt library, so if you've used that (or one of the many clones in other languages) that may be easy for you.
Otherwise, optparse is more Ruby-ish, and thus might feel more natural to use.
精彩评论