My program has a lot of command line options. But I don’t want to overwhelm the user when he types --help. Instead of printing out all options, I’d like to list only the most important ones, printing the rest of them when one types --help=full.
But OptionParser seems to only support printing of the whole list of defined options. I’d like to write my own code that loops over the defined options and prints them out in my way, but OptionParser doesn’t seem to provide any ways to access the options definitions it contains.
Is there a way to access the options in OptionParser that I may have missed? Or is there some good alternative to OptionParser? Or some other approach to this problem?
You could redefine the option
--helpfor your need.In this version,
--helpshows all options, but not-v. You may make your own selection – or write a complete different help.