Open smalls12 opened 4 years ago
It's as easy as doing puts parser; exit
...
Oh fair enough, I guess that works.
I think that printing the help message being just OptionParser#to_s
is a bit confusing.
The example should have an exit
call to demonstrate proper usage.
@RX14 Are you talking about renaming OptionParser#to_s
to something like OptionParser#help
or OptionParser#options
instead? I can't think of better method name.
On the second thought maybe parser.print_help
replacing puts parser.to_s
would do?
Maybe related, does the user have to specify the help option? Could it not just be added in the background automatically?
Hello,
The OptionParser in the documents is as follows
I expected that if you actually used the "-h" or "--help" that the program would display the help and then would end.
However in this example above, the help menu would be printed and the program will continue.
If the program writes a lot of data to the screen, the help menu could be lost until the program ends and then the user scrolls up to see the help.
The solution might be to follow what
parser.invalid_option
does; something likeparser.help
.Could this behavior be added?