feat(cli): add aggregate output format options for docs parity

The README/CONTRIBUTING examples used `obliteratus aggregate --format ...` but the CLI only accepted `--dir`.
This adds `--format {summary,latex}`, `--metric`, and `--min-runs` to the aggregate command, reuses community LaTeX table generation, and adds CLI parsing tests to align behavior with documented usage.
This commit is contained in:
Rached Rayeh
2026-08-13 22:28:29 -04:00
committed by Joseph Magly
parent a5a1ffa584
commit 2295ef3571
2 changed files with 58 additions and 1 deletions
+23
View File
@@ -101,6 +101,29 @@ class TestCLIDispatch:
)
assert "no contributions found" in printed_text.lower() or mock_console.print.called
def test_aggregate_accepts_format_metric_min_runs(self):
"""aggregate accepts --format, --metric and --min-runs flags."""
with patch("obliteratus.cli._cmd_aggregate") as mock_cmd:
main([
"aggregate",
"--format", "latex",
"--metric", "refusal_rate",
"--min-runs", "3",
])
mock_cmd.assert_called_once()
args_passed = mock_cmd.call_args[0][0]
assert args_passed.format == "latex"
assert args_passed.metric == "refusal_rate"
assert args_passed.min_runs == 3
def test_aggregate_rejects_invalid_format(self):
"""aggregate rejects unknown --format choices."""
stderr_text = _capture_exit(
["aggregate", "--format", "invalid"],
expect_code=2,
)
assert "invalid choice" in stderr_text.lower()
# 7. --help flag prints help
def test_help_flag(self):
"""Calling main(['--help']) should print help and exit 0."""