mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-14 10:16:12 +02:00
Fix inverted POSIX check, refactor os_compat, and add tests for it
This commit is contained in:
parent
61f8406412
commit
3c4dc79e8a
6 changed files with 109 additions and 15 deletions
|
@ -6,7 +6,6 @@ from collections import defaultdict
|
|||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import shlex
|
||||
import time
|
||||
from unittest.mock import patch
|
||||
|
||||
|
@ -22,7 +21,7 @@ from jrnl import __version__
|
|||
from jrnl import plugins
|
||||
from jrnl.cli import cli
|
||||
from jrnl.config import load_config
|
||||
from jrnl.os_compat import on_windows
|
||||
from jrnl.os_compat import split_args
|
||||
|
||||
try:
|
||||
import parsedatetime.parsedatetime_consts as pdt
|
||||
|
@ -87,10 +86,6 @@ class FailedKeyring(keyring.backend.KeyringBackend):
|
|||
keyring.set_keyring(TestKeyring())
|
||||
|
||||
|
||||
def ushlex(command):
|
||||
return shlex.split(command, posix=not on_windows)
|
||||
|
||||
|
||||
def read_journal(context, journal_name="default"):
|
||||
configuration = load_config(context.config_path)
|
||||
with open(configuration["journals"][journal_name]) as journal_file:
|
||||
|
@ -300,7 +295,7 @@ def run_with_input(context, command, inputs=""):
|
|||
else:
|
||||
text = iter([inputs])
|
||||
|
||||
args = ushlex(command)[1:]
|
||||
args = split_args(command)[1:]
|
||||
|
||||
def _mock_editor(command):
|
||||
context.editor_command = command
|
||||
|
@ -383,7 +378,7 @@ def run(context, command, text=""):
|
|||
cache_dir = os.path.join("features", "cache", context.cache_dir)
|
||||
command = command.format(cache_dir=cache_dir)
|
||||
|
||||
args = ushlex(command)
|
||||
args = split_args(command)
|
||||
|
||||
def _mock_editor(command):
|
||||
context.editor_command = command
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue