def run(context, command): args = _parse_args(command) try: jrnl.cli(args or None) context.exit_status = 0 except SystemExit as e: context.exit_status = e.code
def run_with_input(context, command, inputs=None): text = inputs or context.text args = _parse_args(command) buffer = StringIO(text.strip()) jrnl.util.STDIN = buffer try: jrnl.cli(args or None) context.exit_status = 0 except SystemExit as e: context.exit_status = e.code