Ziggy
Ziggy

Reputation: 22375

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.

Upvotes: 0

Views: 194

Answers (1)

ewall
ewall

Reputation: 28110

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.

Upvotes: 1

Related Questions