Skip to content

Commit 958b442

Browse files
committed
refactor(cli): add required input-dir argument
1 parent 46ab419 commit 958b442

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

src/balatrobench/cli.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def create_parser() -> argparse.ArgumentParser:
2525
parser.add_argument(
2626
"--input-dir",
2727
type=Path,
28+
required=True,
2829
help="Input directory with run data (e.g., runs/v1.0.0)",
2930
)
3031
parser.add_argument(
@@ -65,10 +66,6 @@ def main() -> None:
6566
args = parser.parse_args()
6667

6768
# Determine input directory
68-
if not args.input_dir:
69-
print("Error: --input-dir is required")
70-
sys.exit(1)
71-
7269
input_dir = args.input_dir.resolve()
7370

7471
if not input_dir.exists():

tests/balatrobench/unit/test_cli.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ def test_create_parser(self) -> None:
164164
# Check parser metadata
165165
assert parser.prog == "balatrobench"
166166

167-
# Parse with no arguments to check defaults
168-
args = parser.parse_args([])
169-
assert args.input_dir is None
167+
# Parse with required argument to check defaults
168+
args = parser.parse_args(["--input-dir", "/some/path"])
169+
assert args.input_dir == Path("/some/path")
170170
assert args.output_dir == Path("site/benchmarks")
171171
assert args.version is None
172172
assert args.webp is False
@@ -217,9 +217,9 @@ def test_main_requires_input_dir(
217217
with pytest.raises(SystemExit) as exc_info:
218218
main()
219219

220-
assert exc_info.value.code == 1
220+
assert exc_info.value.code == 2
221221
captured = capsys.readouterr()
222-
assert "Error: --input-dir is required" in captured.out
222+
assert "required" in captured.err
223223

224224
def test_main_exits_when_input_dir_not_found(
225225
self,

0 commit comments

Comments
 (0)