rename cli.py to main.py

This commit is contained in:
Jonathan Wren 2023-01-10 17:02:31 -08:00
parent e02e10c32c
commit 9985c8a87a
4 changed files with 8 additions and 8 deletions

View file

@ -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())

View file

@ -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

View file

@ -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"

View file

@ -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