update upgrade module to use new message handling

This commit is contained in:
Jonathan Wren 2022-05-01 05:33:14 -07:00
parent 3ccf695f50
commit 48d36ecad9
2 changed files with 6 additions and 3 deletions

View file

@ -25,7 +25,6 @@ class MsgText(Enum):
return self.value
# -- Welcome --- #
WelcomeToJrnl = """
Welcome to jrnl {version}!
@ -43,6 +42,8 @@ class MsgText(Enum):
older versions of jrnl anymore.
"""
AllDoneUpgrade = "We're all done here and you can start enjoying jrnl 2"
# --- Exceptions ---#
UncaughtException = """
{name}
@ -171,6 +172,8 @@ class MsgText(Enum):
Upgrading {journal_type} '{journal_name}' journal stored in {path}...
"""
UpgradingConfig = "Upgrading config..."
PaddedJournalName = "{journal_name:{pad}} -> {path}"
# -- Config --- #

View file

@ -177,11 +177,11 @@ def upgrade_jrnl(config_path):
for j in all_journals:
j.write()
print("\nUpgrading config...", file=sys.stderr)
print_msg(Message(MsgText.UpgradingConfig, MsgType.NORMAL))
backup(config_path)
print("\nWe're all done here and you can start enjoying jrnl 2.", file=sys.stderr)
print_msg(Message(MsgText.AllDoneUpgrade, MsgType.NORMAL))
def is_old_version(config_path):