mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 19:48:31 +02:00
move exception for no editor configured into new handling
This commit is contained in:
parent
e181302ca4
commit
782adef681
2 changed files with 12 additions and 11 deletions
|
@ -61,6 +61,16 @@ class JrnlExceptionMessage(Enum):
|
||||||
jrnl was NOT upgraded
|
jrnl was NOT upgraded
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
EditorNotConfigured = """
|
||||||
|
There is no editor configured.
|
||||||
|
|
||||||
|
To use the --edit option, please specify an editor your config file:
|
||||||
|
{config_file}
|
||||||
|
|
||||||
|
For examples of how to configure an external editor, see:
|
||||||
|
https://jrnl.sh/en/stable/external-editors/
|
||||||
|
"""
|
||||||
|
|
||||||
SomeTest = """
|
SomeTest = """
|
||||||
Some error or something
|
Some error or something
|
||||||
|
|
||||||
|
|
13
jrnl/jrnl.py
13
jrnl/jrnl.py
|
@ -7,8 +7,6 @@ import sys
|
||||||
from . import install
|
from . import install
|
||||||
from . import plugins
|
from . import plugins
|
||||||
from .Journal import open_journal
|
from .Journal import open_journal
|
||||||
from .color import ERROR_COLOR
|
|
||||||
from .color import RESET_COLOR
|
|
||||||
from .config import get_journal_name
|
from .config import get_journal_name
|
||||||
from .config import scope_config
|
from .config import scope_config
|
||||||
from .config import get_config_path
|
from .config import get_config_path
|
||||||
|
@ -241,16 +239,9 @@ def _edit_search_results(config, journal, old_entries, **kwargs):
|
||||||
3. Write modifications to journal
|
3. Write modifications to journal
|
||||||
"""
|
"""
|
||||||
if not config["editor"]:
|
if not config["editor"]:
|
||||||
print(
|
raise JrnlException(
|
||||||
f"""
|
JrnlExceptionMessage.EditorNotConfigured, config_file=get_config_path()
|
||||||
[{ERROR_COLOR}ERROR{RESET_COLOR}: There is no editor configured.]
|
|
||||||
|
|
||||||
Please specify an editor in config file ({get_config_path()})
|
|
||||||
to use the --edit option.
|
|
||||||
""",
|
|
||||||
file=sys.stderr,
|
|
||||||
)
|
)
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# separate entries we are not editing
|
# separate entries we are not editing
|
||||||
other_entries = [e for e in old_entries if e not in journal.entries]
|
other_entries = [e for e in old_entries if e not in journal.entries]
|
||||||
|
|
Loading…
Add table
Reference in a new issue