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:
Kevin 2022-06-04 15:13:30 -07:00 committed by GitHub
parent e758986985
commit c043f5058f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 32 deletions

View file

@ -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())