mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 19:48:31 +02:00
Add warning when --change-time used with no matching entries
This commit is contained in:
parent
14cba37bb9
commit
329d889fc3
3 changed files with 8 additions and 0 deletions
|
@ -339,6 +339,9 @@ def _delete_search_results(journal, old_entries, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def _change_time_search_results(args, journal, old_entries, **kwargs):
|
def _change_time_search_results(args, journal, old_entries, **kwargs):
|
||||||
|
if not journal.entries:
|
||||||
|
raise JrnlException(Message(MsgText.NothingToModify, MsgType.WARNING))
|
||||||
|
|
||||||
# separate entries we are not editing
|
# separate entries we are not editing
|
||||||
other_entries = _other_entries(journal, old_entries)
|
other_entries = _other_entries(journal, old_entries)
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,10 @@ class MsgText(Enum):
|
||||||
No entries to delete, because the search returned no results
|
No entries to delete, because the search returned no results
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
NothingToModify = """
|
||||||
|
No entries to modify, because the search returned no results
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class Message(NamedTuple):
|
class Message(NamedTuple):
|
||||||
text: MsgText
|
text: MsgText
|
||||||
|
|
|
@ -22,6 +22,7 @@ Feature: Change entry times in journal
|
||||||
Scenario Outline: Change time flag with nonsense input changes nothing
|
Scenario Outline: Change time flag with nonsense input changes nothing
|
||||||
Given we use the config "<config_file>"
|
Given we use the config "<config_file>"
|
||||||
When we run "jrnl --change-time now asdfasdf"
|
When we run "jrnl --change-time now asdfasdf"
|
||||||
|
Then the output should contain "No entries to modify"
|
||||||
When we run "jrnl -99 --short"
|
When we run "jrnl -99 --short"
|
||||||
Then the output should be
|
Then the output should be
|
||||||
2020-08-29 11:11 Entry the first.
|
2020-08-29 11:11 Entry the first.
|
||||||
|
|
Loading…
Add table
Reference in a new issue