mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 11:38:32 +02:00
update importer to use new message function
This commit is contained in:
parent
42373760ff
commit
c16aa42d6c
2 changed files with 13 additions and 4 deletions
|
@ -150,6 +150,11 @@ class MsgText(Enum):
|
|||
Headings increased past H6 on export - {date} {title}
|
||||
"""
|
||||
|
||||
# --- Import --- #
|
||||
ImportSummary = """
|
||||
{count} imported to {journal_name} journal
|
||||
"""
|
||||
|
||||
|
||||
class Message(NamedTuple):
|
||||
text: MsgText
|
||||
|
|
|
@ -8,6 +8,7 @@ from jrnl.exception import JrnlException
|
|||
from jrnl.messages import Message
|
||||
from jrnl.messages import MsgText
|
||||
from jrnl.messages import MsgType
|
||||
from jrnl.output import print_msg
|
||||
|
||||
|
||||
class JRNLImporter:
|
||||
|
@ -34,8 +35,11 @@ class JRNLImporter:
|
|||
|
||||
journal.import_(other_journal_txt)
|
||||
new_cnt = len(journal.entries)
|
||||
print(
|
||||
"[{} imported to {} journal]".format(new_cnt - old_cnt, journal.name),
|
||||
file=sys.stderr,
|
||||
)
|
||||
journal.write()
|
||||
print_msg(
|
||||
Message(
|
||||
MsgText.ImportSummary,
|
||||
MsgType.NORMAL,
|
||||
{"count": new_cnt - old_cnt, "journal_name": journal.name},
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue