[plugins] meta --> collector

This commit is contained in:
MinchinWeb 2021-05-16 12:30:49 -06:00
parent 0e5748a8e6
commit 65914e2073
5 changed files with 14 additions and 12 deletions

View file

@ -462,7 +462,7 @@ def load_template(context, filename):
full_path = os.path.join("features/data/templates", filename)
exporter = plugins.template_exporter.__exporter_from_file(full_path)
plugins.meta.__exporter_types[exporter.names[0]] = exporter
plugins.collector.__exporter_types[exporter.names[0]] = exporter
@when('we set the keyring password of "{journal}" to "{password}"')

View file

@ -13,8 +13,8 @@ from .commands import preconfig_diagnostic
from .commands import preconfig_version
from .output import deprecated_cmd
from .plugins import util
from .plugins.meta import EXPORT_FORMATS
from .plugins.meta import IMPORT_FORMATS
from .plugins.collector import EXPORT_FORMATS
from .plugins.collector import IMPORT_FORMATS
class WrappingFormatter(argparse.RawTextHelpFormatter):

View file

@ -28,7 +28,7 @@ def preconfig_diagnostic(_):
def preconfig_version(_):
from jrnl import __title__
from jrnl import __version__
from jrnl.plugins.meta import (
from jrnl.plugins.collector import (
IMPORT_FORMATS,
EXPORT_FORMATS,
get_exporter,
@ -69,7 +69,7 @@ def postconfig_list(config, **kwargs):
def postconfig_import(args, config, **kwargs):
from .Journal import open_journal
from .plugins.meta import get_importer
from .plugins.collector import get_importer
# Requires opening the journal
journal = open_journal(args.journal_name, config)

View file

@ -324,17 +324,17 @@ def _delete_search_results(journal, old_entries, **kwargs):
def _display_search_results(args, journal, **kwargs):
if args.short or args.export == "short":
print(plugins.meta.get_exporter("short").export(journal))
print(plugins.collector.get_exporter("short").export(journal))
elif args.tags:
print(plugins.meta.get_exporter("tags").export(journal))
print(plugins.collector.get_exporter("tags").export(journal))
elif args.export:
exporter = plugins.meta.get_exporter(args.export)
exporter = plugins.collector.get_exporter(args.export)
print(exporter.export(journal, args.filename))
elif kwargs["config"].get("display_format"):
exporter = plugins.meta.get_exporter(kwargs["config"]["display_format"])
exporter = plugins.collector.get_exporter(kwargs["config"]["display_format"])
print(exporter.export(journal, args.filename))
else:
# print(journal.pprint())
print(plugins.meta.get_exporter("default").export(journal))
print(plugins.collector.get_exporter("default").export(journal))

View file

@ -4,8 +4,7 @@
# License: https://www.gnu.org/licenses/gpl-3.0.html
"""
This file ("meta") uses that title in the reflexive sense; i.e. it is the
collection of code that allows plugins to deal with themselves.
Code relating to the collecting of plugins and distributing calls to them.
In particular, the code here collects the list of imports and exporters, both
internal and external, and tells the main program which plugins are available.
@ -14,6 +13,9 @@ functions are importable/callable at predetermined (code) locations.
Internal plugins are located in the `jrnl.plugins` namespace, and external
plugins are located in the `jrnl.contrib` namespace.
This file was originally called "meta", using that title in the reflexive sense;
i.e. it is the collection of code that allows plugins to deal with themselves.
"""
import importlib