开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜