mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-12 09:28:31 +02:00
Bail out of search_mode before editing (rather than after) if no entries match the search
This commit is contained in:
parent
e6e08e5d3e
commit
fce5afff06
1 changed files with 5 additions and 6 deletions
11
jrnl/jrnl.py
11
jrnl/jrnl.py
|
@ -183,8 +183,12 @@ def search_mode(args: "Namespace", journal: Journal, **kwargs) -> None:
|
||||||
_filter_journal_entries(**kwargs)
|
_filter_journal_entries(**kwargs)
|
||||||
_print_entries_found_count(len(journal), args)
|
_print_entries_found_count(len(journal), args)
|
||||||
|
|
||||||
|
if not journal:
|
||||||
|
# Bail out if there are no entries
|
||||||
|
return
|
||||||
|
|
||||||
# Where do the search results go?
|
# Where do the search results go?
|
||||||
if args.edit:
|
elif args.edit:
|
||||||
# If we want to both edit and change time in one action
|
# If we want to both edit and change time in one action
|
||||||
if args.change_time:
|
if args.change_time:
|
||||||
# Generate a new list instead of assigning so it won't be
|
# Generate a new list instead of assigning so it won't be
|
||||||
|
@ -202,11 +206,6 @@ def search_mode(args: "Namespace", journal: Journal, **kwargs) -> None:
|
||||||
journal.entries = selected_entries
|
journal.entries = selected_entries
|
||||||
|
|
||||||
_edit_search_results(**kwargs)
|
_edit_search_results(**kwargs)
|
||||||
|
|
||||||
elif not journal:
|
|
||||||
# Bail out if there are no entries and we're not editing
|
|
||||||
return
|
|
||||||
|
|
||||||
elif args.change_time:
|
elif args.change_time:
|
||||||
_change_time_search_results(**kwargs)
|
_change_time_search_results(**kwargs)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue