X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=argparse_utils.py;h=f73a8936d3eb268b96ea387a543608d24d0ceb51;hb=f6ec577f04044f21076c4c24c6aa2ab784c6cfc9;hp=045d882a2b6c4b18f4a27fd0267a65dd2b4444e4;hpb=5c212d7639f62fcb936f9d7a0bbe704a9f7b213d;p=python_utils.git diff --git a/argparse_utils.py b/argparse_utils.py index 045d882..f73a893 100644 --- a/argparse_utils.py +++ b/argparse_utils.py @@ -1,5 +1,7 @@ #!/usr/bin/python3 +# © Copyright 2021-2022, Scott Gasch + """Helpers for commandline argument parsing.""" import argparse @@ -17,7 +19,7 @@ logger = logging.getLogger(__name__) class ActionNoYes(argparse.Action): - """An argparse Action that allows for commandline arguments like this: + """An argparse Action that allows for commandline arguments like this:: cfg.add_argument( '--enable_the_thing', @@ -26,12 +28,15 @@ class ActionNoYes(argparse.Action): help='Should we enable the thing?' ) - This creates cmdline arguments: + This creates the following cmdline arguments:: --enable_the_thing --no_enable_the_thing + These arguments can be used to indicate the inclusion or exclusion of + binary exclusive behaviors. """ + def __init__(self, option_strings, dest, default=None, required=False, help=None): if default is None: msg = 'You must provide a default with Yes/No action'