mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 00:28:31 +02:00
Add user-friendly message when missing importer (#1959)
This commit is contained in:
parent
1dd2d48068
commit
8329cf5537
2 changed files with 16 additions and 1 deletions
|
@ -76,7 +76,17 @@ def postconfig_import(args: argparse.Namespace, config: dict, **_) -> int:
|
|||
journal = open_journal(args.journal_name, config)
|
||||
|
||||
format = args.export if args.export else "jrnl"
|
||||
get_importer(format).import_(journal, args.filename)
|
||||
|
||||
if (importer := get_importer(format)) is None:
|
||||
raise JrnlException(
|
||||
Message(
|
||||
MsgText.ImporterNotFound,
|
||||
MsgStyle.ERROR,
|
||||
{"format": format},
|
||||
)
|
||||
)
|
||||
|
||||
importer.import_(journal, args.filename)
|
||||
|
||||
return 0
|
||||
|
||||
|
|
|
@ -266,6 +266,11 @@ class MsgText(Enum):
|
|||
{count} imported to {journal_name} journal
|
||||
"""
|
||||
|
||||
ImporterNotFound = """
|
||||
No importer found for file type '{format}'.
|
||||
'{format}' is likely to be an export-only format.
|
||||
"""
|
||||
|
||||
# --- Color --- #
|
||||
InvalidColor = "{key} set to invalid color: {color}"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue