diff --git a/actual/cli/main.py b/actual/cli/main.py index 35b00b7..a294636 100644 --- a/actual/cli/main.py +++ b/actual/cli/main.py @@ -86,7 +86,7 @@ def init( @app.command() -def set_context(context: str = typer.Argument(..., help="Context for this budget context")): +def use_context(context: str = typer.Argument(..., help="Context for this budget context")): """Sets the default context for the CLI.""" if context not in config.budgets: raise ValueError(f"Context '{context}' is not registered. Choose one from {list(config.budgets.keys())}") @@ -96,6 +96,7 @@ def set_context(context: str = typer.Argument(..., help="Context for this budget @app.command() def remove_context(context: str = typer.Argument(..., help="Context to be removed")): + """Removes a configured context from the configuration.""" if context not in config.budgets: raise ValueError(f"Context '{context}' is not registered. Choose one from {list(config.budgets.keys())}") config.budgets.pop(context) diff --git a/setup.py b/setup.py index 6503d8c..3f5dd5c 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,6 @@ }, entry_points=""" [console_scripts] - actual=actual.cli.main:app + actualpy=actual.cli.main:app """, ) diff --git a/tests/test_cli.py b/tests/test_cli.py index 1357666..6c048c8 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -75,12 +75,12 @@ def test_init_interactive(actual_server, mocker): mock_prompt = mocker.patch("typer.prompt") mock_prompt.side_effect = [f"http://localhost:{port}", "mypass", 2, "mypass", "myextra"] assert invoke(["init"]).exit_code == 0 - assert invoke(["set-context", "myextra"]).exit_code == 0 - assert invoke(["set-context", "test"]).exit_code == 0 + assert invoke(["use-context", "myextra"]).exit_code == 0 + assert invoke(["use-context", "test"]).exit_code == 0 # remove extra context assert invoke(["remove-context", "myextra"]).exit_code == 0 # different context should not succeed - assert invoke(["set-context", "myextra"]).exit_code != 0 + assert invoke(["use-context", "myextra"]).exit_code != 0 assert invoke(["remove-context", "myextra"]).exit_code != 0