Using ruby's OptionParser to parse sub-commands
Posted
by rampion
on Stack Overflow
See other posts from Stack Overflow
or by rampion
Published on 2010-04-28T20:28:38Z
Indexed on
2010/04/29
14:07 UTC
Read the original article
Hit count: 409
I'd like to be able to use ruby's OptionParser to parse sub-commands of the form
COMMAND [GLOBAL FLAGS] [SUB-COMMAND [SUB-COMMAND FLAGS]]
like:
git branch -a
gem list foo
I know I could switch to a different option parser library (like Trollop), but I'm interested in learning how to do this from within OptionParser, since I'd like to learn the library better.
Any tips?
© Stack Overflow or respective owner