Skip to content

Commit

Permalink
Added .lower() at end of output_format (#12)
Browse files Browse the repository at this point in the history
If a CLI user uses a capital letter in the output format option, it triggers an exception as it's not recognised

As there's no functionality impact from a user doing this, and it could be common e.g using Json instead of json, then changing output_format to be lower case for the comparison is a quick win for an improved user experience.
  • Loading branch information
LackOfMorals authored Sep 20, 2023
1 parent 37fe2e2 commit 1e8c926
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions aura/api_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ def wrapper(output: str, include: bool, raw: bool, verbose: bool, *args, **kwarg

if data is None:
print("Operation successful")
elif output_format == "json":
elif output_format.lower() == "json":
print(json.dumps(data, indent=2))
elif output_format == "table":
elif output_format.lower() == "table":
out = format_table_output(data)
print(out)
elif output_format == "text":
elif output_format.lower() == "text":
out = format_text_output(data)
print(out)
elif output_format == "yaml":
elif output_format.lower() == "yaml":
print(yaml.dump(data))
else:
raise UnsupportedOutputFormat(output_format)
Expand Down

0 comments on commit 1e8c926

Please sign in to comment.