From 6e7d9369ffd5b48ca9bb45ab8284b261bb416940 Mon Sep 17 00:00:00 2001 From: Daniel D'Avella Date: Wed, 18 Oct 2023 11:14:55 -0400 Subject: [PATCH] Fix argument handling for --log-format option --- src/codemodder/cli.py | 2 +- src/codemodder/logging.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/codemodder/cli.py b/src/codemodder/cli.py index efc89fbb3..a48fa7deb 100644 --- a/src/codemodder/cli.py +++ b/src/codemodder/cli.py @@ -139,7 +139,7 @@ def parse_args(argv, codemod_registry): "--log-format", type=OutputFormat, default=OutputFormat.HUMAN, - choices=[str(x).split(".")[-1].lower() for x in list(OutputFormat)], + choices=[OutputFormat.HUMAN, OutputFormat.JSON], help="the format for the log output", ) parser.add_argument( diff --git a/src/codemodder/logging.py b/src/codemodder/logging.py index 7a050d0d5..5590b9dd5 100644 --- a/src/codemodder/logging.py +++ b/src/codemodder/logging.py @@ -13,6 +13,10 @@ class OutputFormat(Enum): HUMAN = "human" JSON = "json" + def __str__(self): + """For rendering properly in argparse help.""" + return self.value.lower() + def log_section(section_name: str): """