When options are not found - ManageIQ/optimist GitHub Wiki
When an unknown option is given, Optimist will return an unknown argument message by default.
$ ./lesshelp.rb -x
Error: unknown argument '-x'.
Try --help for help.
Adding educate_on_error
will display the help message instead (via educate
).
require 'optimist'
opts = Optimist::options do
opt :cat, "A cat option"
educate_on_error
end
$ ./morehelp.rb -x
Error: unknown argument '-x'.
Options:
-c, --cat A cat option
-h, --help Show this message