Skip to content

Commit

Permalink
Fix argument handling for --log-format option
Browse files Browse the repository at this point in the history
  • Loading branch information
drdavella committed Oct 18, 2023
1 parent 826377f commit 6e7d936
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/codemodder/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions src/codemodder/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down

0 comments on commit 6e7d936

Please sign in to comment.