mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-28 05:26:13 +02:00
Move import to be standalone command to reduce clutter in cli.py
This commit is contained in:
parent
ce07fedc06
commit
a54ed90259
9 changed files with 113 additions and 84 deletions
|
@ -210,8 +210,12 @@ def run_with_input(context, command, inputs=""):
|
|||
|
||||
|
||||
@when('we run "{command}"')
|
||||
@when('we run "{command}" and pipe')
|
||||
@when('we run "{command}" and pipe "{text}"')
|
||||
@when('we run "{command}" with cache directory "{cache_dir}"')
|
||||
def run(context, command, cache_dir=None):
|
||||
def run(context, command, text="", cache_dir=None):
|
||||
text = text or context.text or ""
|
||||
|
||||
if cache_dir is not None:
|
||||
cache_dir = os.path.join("features", "cache", cache_dir)
|
||||
command = command.format(cache_dir=cache_dir)
|
||||
|
@ -224,7 +228,7 @@ def run(context, command, cache_dir=None):
|
|||
try:
|
||||
with patch("sys.argv", args), patch(
|
||||
"subprocess.call", side_effect=_mock_editor
|
||||
):
|
||||
), patch("sys.stdin.read", side_effect=lambda: text):
|
||||
cli.run(args[1:])
|
||||
context.exit_status = 0
|
||||
except SystemExit as e:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue