mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 11:38:32 +02:00
add new 'NothingToDelete' error to replace old behavior
This commit is contained in:
parent
e05257fe47
commit
94feae735e
3 changed files with 9 additions and 5 deletions
|
@ -53,6 +53,10 @@ class JrnlExceptionMessage(Enum):
|
|||
https://github.com/jrnl-org/jrnl/issues/new?title=JournalFailedUpgrade
|
||||
"""
|
||||
|
||||
NothingToDelete = """
|
||||
No entries to delete, because the search returned no results.
|
||||
"""
|
||||
|
||||
UpgradeAborted = """
|
||||
jrnl was NOT upgraded
|
||||
"""
|
||||
|
|
|
@ -18,6 +18,9 @@ from .exception import UserAbort
|
|||
from . import time
|
||||
from .override import apply_overrides
|
||||
|
||||
from jrnl.exception import JrnlException
|
||||
from jrnl.exception import JrnlExceptionMessage
|
||||
|
||||
|
||||
def run(args):
|
||||
"""
|
||||
|
@ -310,11 +313,7 @@ def _pluralize_entry(num):
|
|||
|
||||
def _delete_search_results(journal, old_entries, **kwargs):
|
||||
if not journal.entries:
|
||||
print(
|
||||
"[No entries deleted, because the search returned no results.]",
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
raise JrnlException(JrnlExceptionMessage.NothingToDelete)
|
||||
|
||||
entries_to_delete = journal.prompt_delete_entries()
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ Feature: Delete entries from journal
|
|||
Scenario Outline: Delete flag with nonsense input deletes nothing (issue #932)
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete asdfasdf"
|
||||
Then the output should contain "NothingToDelete"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2020-08-29 11:11 Entry the first.
|
||||
|
|
Loading…
Add table
Reference in a new issue