From 8aeaa6f0a2165e3ad3eaf1ba2668bc99a8746c43 Mon Sep 17 00:00:00 2001 From: Eric Brown Date: Sat, 27 Jan 2024 21:11:50 -0800 Subject: [PATCH] Represent env var DEBUG if set (#241) Conform to command line standards when the DEBUG environment variable is set. https://clig.dev/#environment-variables Signed-off-by: Eric Brown --- precli/cli/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/precli/cli/main.py b/precli/cli/main.py index a507d138..48239f06 100644 --- a/precli/cli/main.py +++ b/precli/cli/main.py @@ -43,6 +43,7 @@ def setup_arg_parser(): description="precli - a static analysis security tool", formatter_class=argparse.RawDescriptionHelpFormatter, ) + parser.add_argument( "-d", "--debug", @@ -244,7 +245,9 @@ def parse_file( def main(): debug = ( logging.DEBUG - if "-d" in sys.argv or "--debug" in sys.argv + if "-d" in sys.argv + or "--debug" in sys.argv + or os.getenv("DEBUG") is not None else logging.INFO ) _init_logger(debug)