mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-12 09:28:31 +02:00
rename cli.py to main.py
This commit is contained in:
parent
e02e10c32c
commit
9985c8a87a
4 changed files with 8 additions and 8 deletions
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from jrnl.cli import cli
|
from jrnl.main import run
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(cli())
|
sys.exit(run())
|
||||||
|
|
|
@ -7,9 +7,9 @@ import traceback
|
||||||
|
|
||||||
from rich.logging import RichHandler
|
from rich.logging import RichHandler
|
||||||
|
|
||||||
|
from jrnl import jrnl
|
||||||
from jrnl.args import parse_args
|
from jrnl.args import parse_args
|
||||||
from jrnl.exception import JrnlException
|
from jrnl.exception import JrnlException
|
||||||
from jrnl.jrnl import run
|
|
||||||
from jrnl.messages import Message
|
from jrnl.messages import Message
|
||||||
from jrnl.messages import MsgStyle
|
from jrnl.messages import MsgStyle
|
||||||
from jrnl.messages import MsgText
|
from jrnl.messages import MsgText
|
||||||
|
@ -32,7 +32,7 @@ def configure_logger(debug: bool = False) -> None:
|
||||||
logging.debug("Logging start")
|
logging.debug("Logging start")
|
||||||
|
|
||||||
|
|
||||||
def cli(manual_args: list[str] | None = None) -> int:
|
def run(manual_args: list[str] | None = None) -> int:
|
||||||
try:
|
try:
|
||||||
if manual_args is None:
|
if manual_args is None:
|
||||||
manual_args = sys.argv[1:]
|
manual_args = sys.argv[1:]
|
||||||
|
@ -41,7 +41,7 @@ def cli(manual_args: list[str] | None = None) -> int:
|
||||||
configure_logger(args.debug)
|
configure_logger(args.debug)
|
||||||
logging.debug("Parsed args:\n%s", args)
|
logging.debug("Parsed args:\n%s", args)
|
||||||
|
|
||||||
status_code = run(args)
|
status_code = jrnl.run(args)
|
||||||
|
|
||||||
except JrnlException as e:
|
except JrnlException as e:
|
||||||
status_code = 1
|
status_code = 1
|
|
@ -63,7 +63,7 @@ tox = "*"
|
||||||
xmltodict = "*"
|
xmltodict = "*"
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
jrnl = 'jrnl.cli:cli'
|
jrnl = 'jrnl.main:run'
|
||||||
|
|
||||||
[tool.poe.tasks]
|
[tool.poe.tasks]
|
||||||
docs-check.default_item_type = "script"
|
docs-check.default_item_type = "script"
|
||||||
|
|
|
@ -8,7 +8,7 @@ from pytest_bdd import when
|
||||||
from pytest_bdd.parsers import parse
|
from pytest_bdd.parsers import parse
|
||||||
from pytest_bdd.parsers import re
|
from pytest_bdd.parsers import re
|
||||||
|
|
||||||
from jrnl.cli import cli
|
from jrnl.main import run
|
||||||
|
|
||||||
|
|
||||||
@when(parse('we change directory to "{directory_name}"'))
|
@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]())
|
mocks[id] = stack.enter_context(factories[id]())
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cli_run["status"] = cli() or 0
|
cli_run["status"] = run() or 0
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
# This happens when input is expected, but don't have any input left
|
# This happens when input is expected, but don't have any input left
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Add table
Reference in a new issue