move run function out of cli and into jrnl

This commit is contained in:
Jonathan Wren 2020-08-16 12:31:57 -07:00
parent 9ccbcdcc7e
commit fe03ab66e9
No known key found for this signature in database
GPG key ID: 43D5FF8722E7F68A
6 changed files with 81 additions and 69 deletions

View file

@ -16,9 +16,9 @@ import yaml
from jrnl import Journal
from jrnl import __version__
from jrnl import cli
from jrnl import install
from jrnl import plugins
from jrnl.cli import cli
from jrnl.config import load_config
from jrnl.os_compat import on_windows
@ -136,7 +136,7 @@ def open_editor_and_enter(context, method, text=""):
patch("subprocess.call", side_effect=_mock_editor_function), \
patch("sys.stdin.isatty", return_value=True) \
:
cli.run(["--edit"])
cli(["--edit"])
# fmt: on
@ -200,7 +200,7 @@ def run_with_input(context, command, inputs=""):
patch("sys.stdin.read", side_effect=text) as mock_read \
:
try:
cli.run(args or [])
cli(args or [])
context.exit_status = 0
except SystemExit as e:
context.exit_status = e.code
@ -236,7 +236,7 @@ def run(context, command, text="", cache_dir=None):
with patch("sys.argv", args), patch(
"subprocess.call", side_effect=_mock_editor
), patch("sys.stdin.read", side_effect=lambda: text):
cli.run(args[1:])
cli(args[1:])
context.exit_status = 0
except SystemExit as e:
context.exit_status = e.code