diff --git a/jrnl/__main__.py b/jrnl/__main__.py index 69a9fd5e..085da2a0 100644 --- a/jrnl/__main__.py +++ b/jrnl/__main__.py @@ -3,7 +3,7 @@ import sys -from jrnl.cli import cli +from jrnl.main import run if __name__ == "__main__": - sys.exit(cli()) + sys.exit(run()) diff --git a/jrnl/cli.py b/jrnl/main.py similarity index 94% rename from jrnl/cli.py rename to jrnl/main.py index a6b159db..a6510f68 100644 --- a/jrnl/cli.py +++ b/jrnl/main.py @@ -7,9 +7,9 @@ import traceback from rich.logging import RichHandler +from jrnl import jrnl from jrnl.args import parse_args from jrnl.exception import JrnlException -from jrnl.jrnl import run from jrnl.messages import Message from jrnl.messages import MsgStyle from jrnl.messages import MsgText @@ -32,7 +32,7 @@ def configure_logger(debug: bool = False) -> None: logging.debug("Logging start") -def cli(manual_args: list[str] | None = None) -> int: +def run(manual_args: list[str] | None = None) -> int: try: if manual_args is None: manual_args = sys.argv[1:] @@ -41,7 +41,7 @@ def cli(manual_args: list[str] | None = None) -> int: configure_logger(args.debug) logging.debug("Parsed args:\n%s", args) - status_code = run(args) + status_code = jrnl.run(args) except JrnlException as e: status_code = 1 diff --git a/pyproject.toml b/pyproject.toml index 26dc4316..715180a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,7 +63,7 @@ tox = "*" xmltodict = "*" [tool.poetry.scripts] -jrnl = 'jrnl.cli:cli' +jrnl = 'jrnl.main:run' [tool.poe.tasks] docs-check.default_item_type = "script" diff --git a/tests/lib/when_steps.py b/tests/lib/when_steps.py index d8ab8e72..38ea4ab1 100644 --- a/tests/lib/when_steps.py +++ b/tests/lib/when_steps.py @@ -8,7 +8,7 @@ from pytest_bdd import when from pytest_bdd.parsers import parse from pytest_bdd.parsers import re -from jrnl.cli import cli +from jrnl.main import run @when(parse('we change directory to "{directory_name}"')) @@ -44,7 +44,7 @@ def we_run_jrnl(cli_run, capsys, keyring): mocks[id] = stack.enter_context(factories[id]()) try: - cli_run["status"] = cli() or 0 + cli_run["status"] = run() or 0 except StopIteration: # This happens when input is expected, but don't have any input left pass