Skip to content

Commit

Permalink
Add shortcut for getting the number of items
Browse files Browse the repository at this point in the history
  • Loading branch information
RealOrangeOne committed Oct 1, 2024
1 parent bb5201d commit bac1bd7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@ By default, a pretty table is output, for easy consumption by humans. `--format`
- `table` (Default)
- `csv`
- `json`
- `count`

Progress output is automatically removed when running non-interactively.
5 changes: 5 additions & 0 deletions heroku_audit/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,17 @@ class Format(str, Enum):
TABLE = "table"
CSV = "csv"
JSON = "json"
COUNT = "count"


FormatOption = Annotated[Format, typer.Option("--format")]


def display_data(data: list[dict], display_format: Format) -> None:
if display_format == Format.COUNT:
print(len(data))
return

if not data:
return

Expand Down

0 comments on commit bac1bd7

Please sign in to comment.