mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-29 22:16:13 +02:00
Fixed error related to display_format in config file for some values (#1495)
* Fixed error related to display_format in config file Now _display_search_results tries to source the export arg from the config file before dispaying search results. * Add BDD test for original bug * update unit test Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com> Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
This commit is contained in:
parent
e758986985
commit
c043f5058f
4 changed files with 71 additions and 32 deletions
14
jrnl/jrnl.py
14
jrnl/jrnl.py
|
@ -374,20 +374,20 @@ def _change_time_search_results(args, journal, old_entries, no_prompt=False, **k
|
|||
|
||||
|
||||
def _display_search_results(args, journal, **kwargs):
|
||||
if args.short or args.export == "short":
|
||||
# Get export format from config file if not provided at the command line
|
||||
args.export = args.export or kwargs["config"].get("display_format")
|
||||
|
||||
if args.tags:
|
||||
print(plugins.get_exporter("tags").export(journal))
|
||||
|
||||
elif args.short or args.export == "short":
|
||||
print(journal.pprint(short=True))
|
||||
|
||||
elif args.export == "pretty":
|
||||
print(journal.pprint())
|
||||
|
||||
elif args.tags:
|
||||
print(plugins.get_exporter("tags").export(journal))
|
||||
|
||||
elif args.export:
|
||||
exporter = plugins.get_exporter(args.export)
|
||||
print(exporter.export(journal, args.filename))
|
||||
elif kwargs["config"].get("display_format"):
|
||||
exporter = plugins.get_exporter(kwargs["config"]["display_format"])
|
||||
print(exporter.export(journal, args.filename))
|
||||
else:
|
||||
print(journal.pprint())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue