mpeterv / argparse

Feature-rich command line parser for Lua
MIT License
251 stars 43 forks source link

Option to not exit on help or error #22

Open giann opened 5 years ago

giann commented 5 years ago

In the context in which I'm using argparse, it would be helpful if I could set an option to not exit when using --help or when the parsing fails.

p-ouellette commented 5 years ago

To not exit when using --help you can override the action of the help option:

parser:add_help {
   action = function() print(parser:get_help()) end
}

To not exit when parsing fails you can use :pparse() instead of :parse().

RoboPterodactyl commented 1 year ago

You can use string.byte(io.read()) to require the user to press enter if that helps.