Skip to content

Option to not exit on help or error #22

Open

Description

@giann

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.

Activity

  1. p-ouellette commented on Mar 28, 2019

    @p-ouellette

    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().

  2. RoboPterodactyl commented on Aug 13, 2023

    @RoboPterodactyl

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions