开发者

Can thor accept unix-like options (such as -lv)?

开发者 https://www.devze.com 2023-03-14 22:36 出处:网络
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 rathe

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消