mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 19:48:31 +02:00
Merge branch 'develop' into ruamel
# Conflicts: # poetry.lock Resolved conflict with poetry update from remote
This commit is contained in:
commit
48ee499088
13 changed files with 235 additions and 124 deletions
|
@ -6,11 +6,14 @@
|
|||
|
||||
**Build:**
|
||||
|
||||
- Clean up .gitignore [\#1286](https://github.com/jrnl-org/jrnl/issues/1286)
|
||||
- Tidy up git ignore [\#1414](https://github.com/jrnl-org/jrnl/pull/1414) ([nelnog](https://github.com/nelnog))
|
||||
- Drop support for Python 3.7 and 3.8 [\#1412](https://github.com/jrnl-org/jrnl/pull/1412) ([micahellison](https://github.com/micahellison))
|
||||
|
||||
**Packaging:**
|
||||
|
||||
- Sync jrnl's Python version support more closely to Python release cycle [\#1406](https://github.com/jrnl-org/jrnl/issues/1406)
|
||||
- Bump yq from 2.13.0 to 2.14.0 [\#1418](https://github.com/jrnl-org/jrnl/pull/1418) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- Bump pytest from 6.2.5 to 7.0.0 [\#1407](https://github.com/jrnl-org/jrnl/pull/1407) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||
|
||||
## [v2.8.4](https://pypi.org/project/jrnl/v2.8.4/) (2022-02-12)
|
||||
|
|
29
jrnl/cli.py
29
jrnl/cli.py
|
@ -3,10 +3,15 @@
|
|||
|
||||
import logging
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
from .jrnl import run
|
||||
from .args import parse_args
|
||||
from .exception import JrnlError
|
||||
from jrnl.jrnl import run
|
||||
from jrnl.args import parse_args
|
||||
from jrnl.output import print_msg
|
||||
from jrnl.exception import JrnlException
|
||||
from jrnl.messages import Message
|
||||
from jrnl.messages import MsgText
|
||||
from jrnl.messages import MsgType
|
||||
|
||||
|
||||
def configure_logger(debug=False):
|
||||
|
@ -33,9 +38,23 @@ def cli(manual_args=None):
|
|||
|
||||
return run(args)
|
||||
|
||||
except JrnlError as e:
|
||||
print(e.message, file=sys.stderr)
|
||||
except JrnlException as e:
|
||||
e.print()
|
||||
return 1
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print_msg(Message(MsgText.KeyboardInterruptMsg, MsgType.WARNING))
|
||||
return 1
|
||||
|
||||
except Exception as e:
|
||||
try:
|
||||
is_debug = args.debug # type: ignore
|
||||
except NameError:
|
||||
# error happened before args were parsed
|
||||
is_debug = "--debug" in sys.argv[1:]
|
||||
|
||||
if is_debug:
|
||||
traceback.print_tb(sys.exc_info()[2])
|
||||
|
||||
print_msg(Message(MsgText.UncaughtException, MsgType.ERROR, {"exception": e}))
|
||||
return 1
|
||||
|
|
|
@ -13,7 +13,10 @@ avoid any possible overhead for these standalone commands.
|
|||
"""
|
||||
import platform
|
||||
import sys
|
||||
from .exception import JrnlError
|
||||
from jrnl.exception import JrnlException
|
||||
from jrnl.messages import Message
|
||||
from jrnl.messages import MsgText
|
||||
from jrnl.messages import MsgType
|
||||
|
||||
|
||||
def preconfig_diagnostic(_):
|
||||
|
@ -70,10 +73,15 @@ def postconfig_encrypt(args, config, original_config, **kwargs):
|
|||
journal = open_journal(args.journal_name, config)
|
||||
|
||||
if hasattr(journal, "can_be_encrypted") and not journal.can_be_encrypted:
|
||||
raise JrnlError(
|
||||
"CannotEncryptJournalType",
|
||||
journal_name=args.journal_name,
|
||||
journal_type=journal.__class__.__name__,
|
||||
raise JrnlException(
|
||||
Message(
|
||||
MsgText.CannotEncryptJournalType,
|
||||
MsgType.ERROR,
|
||||
{
|
||||
"journal_name": args.journal_name,
|
||||
"journal_type": journal.__class__.__name__,
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
journal.config["encrypt"] = True
|
||||
|
|
|
@ -7,7 +7,11 @@ from ruamel.yaml import YAML
|
|||
import xdg.BaseDirectory
|
||||
|
||||
from . import __version__
|
||||
from .exception import JrnlError
|
||||
from jrnl.exception import JrnlException
|
||||
from jrnl.messages import Message
|
||||
from jrnl.messages import MsgText
|
||||
from jrnl.messages import MsgType
|
||||
|
||||
from .color import ERROR_COLOR
|
||||
from .color import RESET_COLOR
|
||||
from .output import list_journals
|
||||
|
@ -67,12 +71,18 @@ def get_config_path():
|
|||
try:
|
||||
config_directory_path = xdg.BaseDirectory.save_config_path(XDG_RESOURCE)
|
||||
except FileExistsError:
|
||||
raise JrnlError(
|
||||
"ConfigDirectoryIsFile",
|
||||
config_directory_path=os.path.join(
|
||||
raise JrnlException(
|
||||
Message(
|
||||
MsgText.ConfigDirectoryIsFile,
|
||||
MsgType.ERROR,
|
||||
{
|
||||
"config_directory_path": os.path.join(
|
||||
xdg.BaseDirectory.xdg_config_home, XDG_RESOURCE
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
return os.path.join(
|
||||
config_directory_path or os.path.expanduser("~"), DEFAULT_CONFIG_NAME
|
||||
)
|
||||
|
|
|
@ -6,10 +6,16 @@ import tempfile
|
|||
import textwrap
|
||||
from pathlib import Path
|
||||
|
||||
from .color import ERROR_COLOR
|
||||
from .color import RESET_COLOR
|
||||
from .os_compat import on_windows
|
||||
from .os_compat import split_args
|
||||
from jrnl.color import ERROR_COLOR
|
||||
from jrnl.color import RESET_COLOR
|
||||
from jrnl.os_compat import on_windows
|
||||
from jrnl.os_compat import split_args
|
||||
from jrnl.output import print_msg
|
||||
|
||||
from jrnl.exception import JrnlException
|
||||
from jrnl.messages import Message
|
||||
from jrnl.messages import MsgText
|
||||
from jrnl.messages import MsgType
|
||||
|
||||
|
||||
def get_text_from_editor(config, template=""):
|
||||
|
@ -47,16 +53,25 @@ def get_text_from_editor(config, template=""):
|
|||
|
||||
|
||||
def get_text_from_stdin():
|
||||
_how_to_quit = "Ctrl+z and then Enter" if on_windows() else "Ctrl+d"
|
||||
print(
|
||||
f"[Writing Entry; on a blank line, press {_how_to_quit} to finish writing]\n",
|
||||
file=sys.stderr,
|
||||
print_msg(
|
||||
Message(
|
||||
MsgText.WritingEntryStart,
|
||||
MsgType.TITLE,
|
||||
{
|
||||
"how_to_quit": MsgText.HowToQuitWindows
|
||||
if on_windows()
|
||||
else MsgText.HowToQuitLinux
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
try:
|
||||
raw = sys.stdin.read()
|
||||
except KeyboardInterrupt:
|
||||
logging.error("Write mode: keyboard interrupt")
|
||||
print("[Entry NOT saved to journal]", file=sys.stderr)
|
||||
sys.exit(0)
|
||||
raise JrnlException(
|
||||
Message(MsgText.KeyboardInterruptMsg, MsgType.ERROR),
|
||||
Message(MsgText.JournalNotSaved, MsgType.WARNING),
|
||||
)
|
||||
|
||||
return raw
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Copyright (C) 2012-2021 jrnl contributors
|
||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||
import textwrap
|
||||
from jrnl.messages import Message
|
||||
from jrnl.output import print_msg
|
||||
|
||||
|
||||
class UserAbort(Exception):
|
||||
|
@ -13,40 +14,12 @@ class UpgradeValidationException(Exception):
|
|||
pass
|
||||
|
||||
|
||||
class JrnlError(Exception):
|
||||
class JrnlException(Exception):
|
||||
"""Common exceptions raised by jrnl."""
|
||||
|
||||
def __init__(self, error_type, **kwargs):
|
||||
self.error_type = error_type
|
||||
self.message = self._get_error_message(**kwargs)
|
||||
def __init__(self, *messages: Message):
|
||||
self.messages = messages
|
||||
|
||||
def _get_error_message(self, **kwargs):
|
||||
error_messages = {
|
||||
"ConfigDirectoryIsFile": """
|
||||
The path to your jrnl configuration directory is a file, not a directory:
|
||||
|
||||
{config_directory_path}
|
||||
|
||||
Removing this file will allow jrnl to save its configuration.
|
||||
""",
|
||||
"LineWrapTooSmallForDateFormat": """
|
||||
The provided linewrap value of {config_linewrap} is too small by
|
||||
{columns} columns to display the timestamps in the configured time
|
||||
format for journal {journal}.
|
||||
|
||||
You can avoid this error by specifying a linewrap value that is larger
|
||||
by at least {columns} in the configuration file or by using
|
||||
--config-override at the command line
|
||||
""",
|
||||
"CannotEncryptJournalType": """
|
||||
The journal {journal_name} can't be encrypted because it is a
|
||||
{journal_type} journal.
|
||||
|
||||
To encrypt it, create a new journal referencing a file, export
|
||||
this journal to the new journal, then encrypt the new journal.
|
||||
""",
|
||||
}
|
||||
|
||||
msg = error_messages[self.error_type].format(**kwargs)
|
||||
msg = textwrap.dedent(msg)
|
||||
return msg
|
||||
def print(self) -> None:
|
||||
for msg in self.messages:
|
||||
print_msg(msg)
|
||||
|
|
79
jrnl/messages.py
Normal file
79
jrnl/messages.py
Normal file
|
@ -0,0 +1,79 @@
|
|||
from enum import Enum
|
||||
from typing import NamedTuple
|
||||
from typing import Mapping
|
||||
|
||||
|
||||
class _MsgColor(NamedTuple):
|
||||
# This is a colorama color, and colorama doesn't support enums or type hints
|
||||
# see: https://github.com/tartley/colorama/issues/91
|
||||
color: str
|
||||
|
||||
|
||||
class MsgType(Enum):
|
||||
TITLE = _MsgColor("cyan")
|
||||
NORMAL = _MsgColor("white")
|
||||
WARNING = _MsgColor("yellow")
|
||||
ERROR = _MsgColor("red")
|
||||
|
||||
@property
|
||||
def color(self) -> _MsgColor:
|
||||
return self.value.color
|
||||
|
||||
|
||||
class MsgText(Enum):
|
||||
def __str__(self) -> str:
|
||||
return self.value
|
||||
|
||||
# --- Exceptions ---#
|
||||
UncaughtException = """
|
||||
ERROR
|
||||
{exception}
|
||||
|
||||
This is probably a bug. Please file an issue at:
|
||||
https://github.com/jrnl-org/jrnl/issues/new/choose
|
||||
"""
|
||||
|
||||
ConfigDirectoryIsFile = """
|
||||
The path to your jrnl configuration directory is a file, not a directory:
|
||||
|
||||
{config_directory_path}
|
||||
|
||||
Removing this file will allow jrnl to save its configuration.
|
||||
"""
|
||||
|
||||
LineWrapTooSmallForDateFormat = """
|
||||
The provided linewrap value of {config_linewrap} is too small by
|
||||
{columns} columns to display the timestamps in the configured time
|
||||
format for journal {journal}.
|
||||
|
||||
You can avoid this error by specifying a linewrap value that is larger
|
||||
by at least {columns} in the configuration file or by using
|
||||
--config-override at the command line
|
||||
"""
|
||||
|
||||
CannotEncryptJournalType = """
|
||||
The journal {journal_name} can't be encrypted because it is a
|
||||
{journal_type} journal.
|
||||
|
||||
To encrypt it, create a new journal referencing a file, export
|
||||
this journal to the new journal, then encrypt the new journal.
|
||||
"""
|
||||
|
||||
KeyboardInterruptMsg = "Aborted by user"
|
||||
|
||||
# --- Journal status ---#
|
||||
JournalNotSaved = "Entry NOT saved to journal"
|
||||
|
||||
# --- Editor ---#
|
||||
WritingEntryStart = """
|
||||
Writing Entry
|
||||
To finish writing, press {how_to_quit} on a blank line.
|
||||
"""
|
||||
HowToQuitWindows = "Ctrl+z and then Enter"
|
||||
HowToQuitLinux = "Ctrl+d"
|
||||
|
||||
|
||||
class Message(NamedTuple):
|
||||
text: MsgText
|
||||
type: MsgType = MsgType.NORMAL
|
||||
params: Mapping = {}
|
|
@ -2,14 +2,16 @@
|
|||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
import logging
|
||||
|
||||
|
||||
def deprecated_cmd(old_cmd, new_cmd, callback=None, **kwargs):
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
from .color import RESET_COLOR
|
||||
from .color import WARNING_COLOR
|
||||
from jrnl.color import colorize
|
||||
from jrnl.color import RESET_COLOR
|
||||
from jrnl.color import WARNING_COLOR
|
||||
from jrnl.messages import Message
|
||||
|
||||
|
||||
def deprecated_cmd(old_cmd, new_cmd, callback=None, **kwargs):
|
||||
|
||||
warning_msg = f"""
|
||||
The command {old_cmd} is deprecated and will be removed from jrnl soon.
|
||||
|
@ -34,3 +36,16 @@ def list_journals(configuration):
|
|||
journal, ml, cfg["journal"] if isinstance(cfg, dict) else cfg
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
def print_msg(msg: Message):
|
||||
msg_text = textwrap.dedent(msg.text.value.format(**msg.params)).strip().split("\n")
|
||||
|
||||
longest_string = len(max(msg_text, key=len))
|
||||
msg_text = [f"[ {line:<{longest_string}} ]" for line in msg_text]
|
||||
|
||||
# colorize can't be called until after the lines are padded,
|
||||
# because python gets confused by the ansi color codes
|
||||
msg_text[0] = f"[{colorize(msg_text[0][1:-1], msg.type.color)}]"
|
||||
|
||||
print("\n".join(msg_text), file=sys.stderr)
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
# Copyright (C) 2012-2021 jrnl contributors
|
||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from jrnl.exception import JrnlError
|
||||
from jrnl.exception import JrnlException
|
||||
from jrnl.messages import Message
|
||||
from jrnl.messages import MsgText
|
||||
from jrnl.messages import MsgType
|
||||
from textwrap import TextWrapper
|
||||
|
||||
from .text_exporter import TextExporter
|
||||
|
@ -40,7 +43,7 @@ class FancyExporter(TextExporter):
|
|||
card = [
|
||||
cls.border_a + cls.border_b * (initial_linewrap) + cls.border_c + date_str
|
||||
]
|
||||
check_provided_linewrap_viability(linewrap, card, entry.journal)
|
||||
check_provided_linewrap_viability(linewrap, card, entry.journal.name)
|
||||
|
||||
w = TextWrapper(
|
||||
width=initial_linewrap,
|
||||
|
@ -84,9 +87,14 @@ class FancyExporter(TextExporter):
|
|||
def check_provided_linewrap_viability(linewrap, card, journal):
|
||||
if len(card[0]) > linewrap:
|
||||
width_violation = len(card[0]) - linewrap
|
||||
raise JrnlError(
|
||||
"LineWrapTooSmallForDateFormat",
|
||||
config_linewrap=linewrap,
|
||||
columns=width_violation,
|
||||
journal=journal,
|
||||
raise JrnlException(
|
||||
Message(
|
||||
MsgText.LineWrapTooSmallForDateFormat,
|
||||
MsgType.NORMAL,
|
||||
{
|
||||
"config_linewrap": linewrap,
|
||||
"columns": width_violation,
|
||||
"journal": journal,
|
||||
},
|
||||
)
|
||||
)
|
||||
|
|
54
poetry.lock
generated
54
poetry.lock
generated
|
@ -172,7 +172,7 @@ python-versions = ">=3.5"
|
|||
|
||||
[[package]]
|
||||
name = "executing"
|
||||
version = "0.8.2"
|
||||
version = "0.8.3"
|
||||
description = "Get the currently executing AST node of a frame, and other information"
|
||||
category = "dev"
|
||||
optional = false
|
||||
|
@ -215,7 +215,7 @@ python-versions = "*"
|
|||
|
||||
[[package]]
|
||||
name = "importlib-metadata"
|
||||
version = "4.11.1"
|
||||
version = "4.11.2"
|
||||
description = "Read metadata from Python packages"
|
||||
category = "main"
|
||||
optional = false
|
||||
|
@ -225,7 +225,7 @@ python-versions = ">=3.7"
|
|||
zipp = ">=0.5"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
||||
docs = ["sphinx", "jaraco.packaging (>=9)", "rst.linker (>=1.9)"]
|
||||
perf = ["ipython"]
|
||||
testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)", "importlib-resources (>=1.3)"]
|
||||
|
||||
|
@ -252,7 +252,7 @@ toml = {version = ">=0.10.2", markers = "python_version > \"3.6\""}
|
|||
|
||||
[[package]]
|
||||
name = "ipython"
|
||||
version = "8.0.1"
|
||||
version = "8.1.1"
|
||||
description = "IPython: Productive Interactive Computing"
|
||||
category = "dev"
|
||||
optional = false
|
||||
|
@ -261,7 +261,6 @@ python-versions = ">=3.8"
|
|||
[package.dependencies]
|
||||
appnope = {version = "*", markers = "sys_platform == \"darwin\""}
|
||||
backcall = "*"
|
||||
black = "*"
|
||||
colorama = {version = "*", markers = "sys_platform == \"win32\""}
|
||||
decorator = "*"
|
||||
jedi = ">=0.16"
|
||||
|
@ -269,21 +268,22 @@ matplotlib-inline = "*"
|
|||
pexpect = {version = ">4.3", markers = "sys_platform != \"win32\""}
|
||||
pickleshare = "*"
|
||||
prompt-toolkit = ">=2.0.0,<3.0.0 || >3.0.0,<3.0.1 || >3.0.1,<3.1.0"
|
||||
pygments = "*"
|
||||
pygments = ">=2.4.0"
|
||||
stack-data = "*"
|
||||
traitlets = ">=5"
|
||||
|
||||
[package.extras]
|
||||
all = ["Sphinx (>=1.3)", "curio", "ipykernel", "ipyparallel", "ipywidgets", "matplotlib (!=3.2.0)", "nbconvert", "nbformat", "notebook", "numpy (>=1.19)", "pandas", "pygments", "pytest", "pytest-asyncio", "qtconsole", "testpath", "trio"]
|
||||
all = ["black", "Sphinx (>=1.3)", "ipykernel", "nbconvert", "nbformat", "ipywidgets", "notebook", "ipyparallel", "qtconsole", "curio", "matplotlib (!=3.2.0)", "numpy (>=1.19)", "pandas", "pytest", "testpath", "trio", "pytest-asyncio"]
|
||||
black = ["black"]
|
||||
doc = ["Sphinx (>=1.3)"]
|
||||
kernel = ["ipykernel"]
|
||||
nbconvert = ["nbconvert"]
|
||||
nbformat = ["nbformat"]
|
||||
notebook = ["notebook", "ipywidgets"]
|
||||
notebook = ["ipywidgets", "notebook"]
|
||||
parallel = ["ipyparallel"]
|
||||
qtconsole = ["qtconsole"]
|
||||
test = ["pytest", "pytest-asyncio", "testpath", "pygments"]
|
||||
test_extra = ["pytest", "testpath", "curio", "matplotlib (!=3.2.0)", "nbformat", "numpy (>=1.19)", "pandas", "pygments", "trio"]
|
||||
test = ["pytest", "pytest-asyncio", "testpath"]
|
||||
test_extra = ["curio", "matplotlib (!=3.2.0)", "nbformat", "numpy (>=1.19)", "pandas", "pytest", "testpath", "trio"]
|
||||
|
||||
[[package]]
|
||||
name = "jedi"
|
||||
|
@ -346,11 +346,11 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
|
|||
|
||||
[[package]]
|
||||
name = "mako"
|
||||
version = "1.1.6"
|
||||
version = "1.2.0"
|
||||
description = "A super-fast templating language that borrows the best ideas from the existing templating languages."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[package.dependencies]
|
||||
MarkupSafe = ">=0.9.2"
|
||||
|
@ -358,6 +358,7 @@ MarkupSafe = ">=0.9.2"
|
|||
[package.extras]
|
||||
babel = ["babel"]
|
||||
lingua = ["lingua"]
|
||||
testing = ["pytest"]
|
||||
|
||||
[[package]]
|
||||
name = "markdown"
|
||||
|
@ -752,14 +753,13 @@ pyyaml = "*"
|
|||
|
||||
[[package]]
|
||||
name = "rich"
|
||||
version = "11.2.0"
|
||||
version = "12.0.0"
|
||||
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6.2,<4.0.0"
|
||||
|
||||
[package.dependencies]
|
||||
colorama = ">=0.4.0,<0.5.0"
|
||||
commonmark = ">=0.9.0,<0.10.0"
|
||||
pygments = ">=2.6.0,<3.0.0"
|
||||
|
||||
|
@ -908,7 +908,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
|||
|
||||
[[package]]
|
||||
name = "yq"
|
||||
version = "2.13.0"
|
||||
version = "2.14.0"
|
||||
description = "Command-line YAML/XML processor - jq wrapper for YAML/XML documents"
|
||||
category = "dev"
|
||||
optional = false
|
||||
|
@ -1091,8 +1091,8 @@ decorator = [
|
|||
{file = "decorator-5.1.1.tar.gz", hash = "sha256:637996211036b6385ef91435e4fae22989472f9d571faba8927ba8253acbc330"},
|
||||
]
|
||||
executing = [
|
||||
{file = "executing-0.8.2-py2.py3-none-any.whl", hash = "sha256:32fc6077b103bd19e6494a72682d66d5763cf20a106d5aa7c5ccbea4e47b0df7"},
|
||||
{file = "executing-0.8.2.tar.gz", hash = "sha256:c23bf42e9a7b9b212f185b1b2c3c91feb895963378887bb10e64a2e612ec0023"},
|
||||
{file = "executing-0.8.3-py2.py3-none-any.whl", hash = "sha256:d1eef132db1b83649a3905ca6dd8897f71ac6f8cac79a7e58a1a09cf137546c9"},
|
||||
{file = "executing-0.8.3.tar.gz", hash = "sha256:c6554e21c6b060590a6d3be4b82fb78f8f0194d809de5ea7df1c093763311501"},
|
||||
]
|
||||
flake8 = [
|
||||
{file = "flake8-4.0.1-py2.py3-none-any.whl", hash = "sha256:479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d"},
|
||||
|
@ -1106,8 +1106,8 @@ glob2 = [
|
|||
{file = "glob2-0.7.tar.gz", hash = "sha256:85c3dbd07c8aa26d63d7aacee34fa86e9a91a3873bc30bf62ec46e531f92ab8c"},
|
||||
]
|
||||
importlib-metadata = [
|
||||
{file = "importlib_metadata-4.11.1-py3-none-any.whl", hash = "sha256:e0bc84ff355328a4adfc5240c4f211e0ab386f80aa640d1b11f0618a1d282094"},
|
||||
{file = "importlib_metadata-4.11.1.tar.gz", hash = "sha256:175f4ee440a0317f6e8d81b7f8d4869f93316170a65ad2b007d2929186c8052c"},
|
||||
{file = "importlib_metadata-4.11.2-py3-none-any.whl", hash = "sha256:d16e8c1deb60de41b8e8ed21c1a7b947b0bc62fab7e1d470bcdf331cea2e6735"},
|
||||
{file = "importlib_metadata-4.11.2.tar.gz", hash = "sha256:b36ffa925fe3139b2f6ff11d6925ffd4fa7bc47870165e3ac260ac7b4f91e6ac"},
|
||||
]
|
||||
iniconfig = [
|
||||
{file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"},
|
||||
|
@ -1117,8 +1117,8 @@ ipdb = [
|
|||
{file = "ipdb-0.13.9.tar.gz", hash = "sha256:951bd9a64731c444fd907a5ce268543020086a697f6be08f7cc2c9a752a278c5"},
|
||||
]
|
||||
ipython = [
|
||||
{file = "ipython-8.0.1-py3-none-any.whl", hash = "sha256:c503a0dd6ccac9c8c260b211f2dd4479c042b49636b097cc9a0d55fe62dff64c"},
|
||||
{file = "ipython-8.0.1.tar.gz", hash = "sha256:ab564d4521ea8ceaac26c3a2c6e5ddbca15c8848fd5a5cc325f960da88d42974"},
|
||||
{file = "ipython-8.1.1-py3-none-any.whl", hash = "sha256:6f56bfaeaa3247aa3b9cd3b8cbab3a9c0abf7428392f97b21902d12b2f42a381"},
|
||||
{file = "ipython-8.1.1.tar.gz", hash = "sha256:8138762243c9b3a3ffcf70b37151a2a35c23d3a29f9743878c33624f4207be3d"},
|
||||
]
|
||||
jedi = [
|
||||
{file = "jedi-0.18.1-py2.py3-none-any.whl", hash = "sha256:637c9635fcf47945ceb91cd7f320234a7be540ded6f3e99a50cb6febdfd1ba8d"},
|
||||
|
@ -1137,8 +1137,8 @@ keyring = [
|
|||
{file = "keyring-23.5.0.tar.gz", hash = "sha256:9012508e141a80bd1c0b6778d5c610dd9f8c464d75ac6774248500503f972fb9"},
|
||||
]
|
||||
mako = [
|
||||
{file = "Mako-1.1.6-py2.py3-none-any.whl", hash = "sha256:afaf8e515d075b22fad7d7b8b30e4a1c90624ff2f3733a06ec125f5a5f043a57"},
|
||||
{file = "Mako-1.1.6.tar.gz", hash = "sha256:4e9e345a41924a954251b95b4b28e14a301145b544901332e658907a7464b6b2"},
|
||||
{file = "Mako-1.2.0-py3-none-any.whl", hash = "sha256:23aab11fdbbb0f1051b93793a58323ff937e98e34aece1c4219675122e57e4ba"},
|
||||
{file = "Mako-1.2.0.tar.gz", hash = "sha256:9a7c7e922b87db3686210cf49d5d767033a41d4010b284e747682c92bddd8b39"},
|
||||
]
|
||||
markdown = [
|
||||
{file = "Markdown-3.3.6-py3-none-any.whl", hash = "sha256:9923332318f843411e9932237530df53162e29dc7a4e2b91e35764583c46c9a3"},
|
||||
|
@ -1356,8 +1356,8 @@ pyyaml-env-tag = [
|
|||
{file = "pyyaml_env_tag-0.1.tar.gz", hash = "sha256:70092675bda14fdec33b31ba77e7543de9ddc88f2e5b99160396572d11525bdb"},
|
||||
]
|
||||
rich = [
|
||||
{file = "rich-11.2.0-py3-none-any.whl", hash = "sha256:d5f49ad91fb343efcae45a2b2df04a9755e863e50413623ab8c9e74f05aee52b"},
|
||||
{file = "rich-11.2.0.tar.gz", hash = "sha256:1a6266a5738115017bb64a66c59c717e7aa047b3ae49a011ede4abdeffc6536e"},
|
||||
{file = "rich-12.0.0-py3-none-any.whl", hash = "sha256:fdcd2f8d416e152bcf35c659987038d1ae5a7bd336e821ca7551858a4c7e38a9"},
|
||||
{file = "rich-12.0.0.tar.gz", hash = "sha256:14bfd0507edc633e021b02c45cbf7ca22e33b513817627b8de3412f047a3e798"},
|
||||
]
|
||||
"ruamel.yaml" = [
|
||||
{file = "ruamel.yaml-0.17.21-py3-none-any.whl", hash = "sha256:742b35d3d665023981bd6d16b3d24248ce5df75fdb4e2924e93a05c1f8b61ca7"},
|
||||
|
@ -1460,8 +1460,8 @@ xmltodict = [
|
|||
{file = "xmltodict-0.12.0.tar.gz", hash = "sha256:50d8c638ed7ecb88d90561beedbf720c9b4e851a9fa6c47ebd64e99d166d8a21"},
|
||||
]
|
||||
yq = [
|
||||
{file = "yq-2.13.0-py2.py3-none-any.whl", hash = "sha256:3ae1f647c85f76d48005d75445917cbea2f4d734bae9c7409372340583c2a6c1"},
|
||||
{file = "yq-2.13.0.tar.gz", hash = "sha256:fd131fdb1f56716ad8d44cd9eaaf7d3b22d39ba8861ea64a409cc3f4ae263db8"},
|
||||
{file = "yq-2.14.0-py3-none-any.whl", hash = "sha256:b6321b29cb39c4e92a4a6f16d47d99a024650211e45e09a02d1906ec45fbaede"},
|
||||
{file = "yq-2.14.0.tar.gz", hash = "sha256:f4bf2b299d1e5c7ebd74cfb25d1f5d9b6401063bac07a2d09a156144c1d644e1"},
|
||||
]
|
||||
zipp = [
|
||||
{file = "zipp-3.7.0-py3-none-any.whl", hash = "sha256:b47250dd24f92b7dd6a0a8fc5244da14608f3ca90a5efcd37a3b1642fac9a375"},
|
||||
|
|
|
@ -96,7 +96,7 @@ Feature: Writing new entries.
|
|||
When we run "jrnl --config-override editor ''" and enter ""
|
||||
Then the stdin prompt should have been called
|
||||
And the output should be empty
|
||||
And the error output should contain "Writing Entry; on a blank line"
|
||||
And the error output should contain "To finish writing, press"
|
||||
And the editor should not have been called
|
||||
|
||||
Examples: configs
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
import textwrap
|
||||
|
||||
from jrnl.exception import JrnlError
|
||||
|
||||
|
||||
def test_config_directory_exception_message():
|
||||
ex = JrnlError(
|
||||
"ConfigDirectoryIsFile", config_directory_path="/config/directory/path"
|
||||
)
|
||||
|
||||
assert ex.message == textwrap.dedent(
|
||||
"""
|
||||
The path to your jrnl configuration directory is a file, not a directory:
|
||||
|
||||
/config/directory/path
|
||||
|
||||
Removing this file will allow jrnl to save its configuration.
|
||||
"""
|
||||
)
|
|
@ -1,6 +1,7 @@
|
|||
import pytest
|
||||
|
||||
from jrnl.exception import JrnlError
|
||||
from jrnl.exception import JrnlException
|
||||
|
||||
from jrnl.plugins.fancy_exporter import check_provided_linewrap_viability
|
||||
|
||||
|
||||
|
@ -23,6 +24,5 @@ class TestFancy:
|
|||
|
||||
total_linewrap = 12
|
||||
|
||||
with pytest.raises(JrnlError) as e:
|
||||
with pytest.raises(JrnlException):
|
||||
check_provided_linewrap_viability(total_linewrap, [content], journal)
|
||||
assert e.value.error_type == "LineWrapTooSmallForDateFormat"
|
||||
|
|
Loading…
Add table
Reference in a new issue