diff --git a/concore_cli/README.md b/concore_cli/README.md index 78f98b1..65bf531 100644 --- a/concore_cli/README.md +++ b/concore_cli/README.md @@ -8,6 +8,12 @@ A command-line interface for managing concore neuromodulation workflows. pip install -e . ``` +If the `concore` command is not on your `PATH`, the same CLI runs as a module: + +```bash +python3 -m concore_cli --help +``` + ## Quick Start ```bash diff --git a/concore_cli/__main__.py b/concore_cli/__main__.py new file mode 100644 index 0000000..251f630 --- /dev/null +++ b/concore_cli/__main__.py @@ -0,0 +1,4 @@ +from .cli import cli + +if __name__ == "__main__": + cli(prog_name="concore") diff --git a/tests/test_cli_main_module.py b/tests/test_cli_main_module.py new file mode 100644 index 0000000..bdd97eb --- /dev/null +++ b/tests/test_cli_main_module.py @@ -0,0 +1,27 @@ +import subprocess +import sys +from pathlib import Path + +REPO = Path(__file__).resolve().parent.parent + + +def _run(*args): + return subprocess.run( + [sys.executable, "-m", "concore_cli", *args], + cwd=REPO, + capture_output=True, + text=True, + ) + + +def test_python_dash_m_runs_the_cli(): + result = _run("--version") + assert result.returncode == 0, result.stderr + assert result.stdout.startswith("concore, version ") + + +def test_python_dash_m_shows_commands_under_the_concore_name(): + result = _run("--help") + assert result.returncode == 0, result.stderr + assert "Usage: concore" in result.stdout + assert "validate" in result.stdout