(inputs: list[Path], json_output=str | None)
| 1494 | |
| 1495 | |
| 1496 | def output_stats(inputs: list[Path], json_output=str | None): |
| 1497 | match len(inputs): |
| 1498 | case 1: |
| 1499 | data = load_raw_data(Path(inputs[0])) |
| 1500 | if json_output is not None: |
| 1501 | with open(json_output, "w", encoding="utf-8") as f: |
| 1502 | save_raw_data(data, f) # type: ignore |
| 1503 | stats = Stats(data) |
| 1504 | output_markdown(sys.stdout, LAYOUT, stats) |
| 1505 | case 2: |
| 1506 | if json_output is not None: |
| 1507 | raise ValueError( |
| 1508 | "Can not output to JSON when there are multiple inputs" |
| 1509 | ) |
| 1510 | base_data = load_raw_data(Path(inputs[0])) |
| 1511 | head_data = load_raw_data(Path(inputs[1])) |
| 1512 | base_stats = Stats(base_data) |
| 1513 | head_stats = Stats(head_data) |
| 1514 | output_markdown(sys.stdout, LAYOUT, base_stats, head_stats) |
| 1515 | |
| 1516 | |
| 1517 | def main(): |
no test coverage detected
searching dependent graphs…