Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to not exit on help or error #22

Open
giann opened this issue Mar 1, 2019 · 2 comments
Open

Option to not exit on help or error #22

giann opened this issue Mar 1, 2019 · 2 comments

Comments

@giann
Copy link

giann commented Mar 1, 2019

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
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants