diff --git a/falyx/__main__.py b/falyx/__main__.py index 67f422c..ddd98d4 100644 --- a/falyx/__main__.py +++ b/falyx/__main__.py @@ -50,7 +50,7 @@ def get_falyx_parsers() -> FalyxParsers: return falyx_parsers -def main(args: Namespace) -> Any: +def run(args: Namespace) -> Any: if args.command == "init": from falyx.init import init_project @@ -77,7 +77,11 @@ def main(args: Namespace) -> Any: return asyncio.run(flx.run()) -if __name__ == "__main__": +def main(): parsers = get_falyx_parsers() args = parsers.parse_args() - main(args) + run(args) + + +if __name__ == "__main__": + main() diff --git a/falyx/version.py b/falyx/version.py index 3cb7d95..fb69db9 100644 --- a/falyx/version.py +++ b/falyx/version.py @@ -1 +1 @@ -__version__ = "0.1.13" +__version__ = "0.1.14" diff --git a/pyproject.toml b/pyproject.toml index abf3d5c..26d487c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "falyx" -version = "0.1.13" +version = "0.1.14" description = "Reliable and introspectable async CLI action framework." authors = ["Roland Thomas Jr "] license = "MIT" diff --git a/tests/test_main.py b/tests/test_main.py index 69f5dfd..58485d9 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -5,7 +5,7 @@ from pathlib import Path import pytest -from falyx.__main__ import bootstrap, find_falyx_config, get_falyx_parsers, main +from falyx.__main__ import bootstrap, find_falyx_config, get_falyx_parsers, run def test_find_falyx_config(): @@ -64,11 +64,11 @@ def test_parse_args(): assert args.command == "init-global" -def test_main(): - """Test if the main function works correctly.""" +def test_run(): + """Test if the run function works correctly.""" falyx_parsers = get_falyx_parsers() args = falyx_parsers.parse_args(["init", "test_project"]) - main(args) + run(args) assert args.command == "init" assert args.name == "test_project" # Check if the project directory was created @@ -79,7 +79,7 @@ def test_main(): Path("test_project").rmdir() # Test init-global args = falyx_parsers.parse_args(["init-global"]) - main(args) + run(args) # Check if the global config directory was created assert (Path.home() / ".config" / "falyx" / "falyx.yaml").exists() # Clean up @@ -92,7 +92,7 @@ def test_no_bootstrap(): """Test if the main function works correctly when no config file is found.""" falyx_parsers = get_falyx_parsers() args = falyx_parsers.parse_args(["list"]) - assert main(args) is None + assert run(args) is None # Check if the task was run assert args.command == "list" @@ -101,12 +101,12 @@ def test_run_test_project(): """Test if the main function works correctly with a test project.""" falyx_parsers = get_falyx_parsers() args = falyx_parsers.parse_args(["init", "test_project"]) - main(args) + run(args) args = falyx_parsers.parse_args(["run", "B"]) os.chdir("test_project") with pytest.raises(SystemExit): - assert main(args) == "Build complete!" + assert run(args) == "Build complete!" os.chdir("..") shutil.rmtree("test_project") assert not Path("test_project").exists()