update install module to use new message function

This commit is contained in:
Jonathan Wren 2022-05-01 03:58:02 -07:00
parent 7690594aac
commit 2df7419ac1
2 changed files with 9 additions and 4 deletions

View file

@ -17,6 +17,7 @@ from .config import verify_config_colors
from .prompt import yesno
from .upgrade import is_old_version
from jrnl.output import print_msg
from jrnl.exception import JrnlException
from jrnl.messages import Message
from jrnl.messages import MsgText
@ -35,9 +36,8 @@ def upgrade_config(config_data, alt_config_path=None):
config_data[key] = default_config[key]
save_config(config_data, alt_config_path)
config_path = alt_config_path if alt_config_path else get_config_path()
print(
f"[Configuration updated to newest version at {config_path}]",
file=sys.stderr,
print_msg(
Message(MsgText.ConfigUpdated, MsgType.NORMAL, {"config_path": config_path})
)
@ -121,7 +121,7 @@ def install():
)
if encrypt:
default_config["encrypt"] = True
print("Journal will be encrypted.", file=sys.stderr)
print_msg(Message(MsgText.JournalEncrypted, MsgType.NORMAL))
save_config(default_config)
return default_config

View file

@ -89,6 +89,7 @@ class MsgText(Enum):
JournalCreated = "Journal '{journal_name}' created at {filename}"
DirectoryCreated = "Directory {directory_name} created"
JournalEncrypted = "Journal will be encrypted."
# --- Editor ---#
WritingEntryStart = """
@ -138,6 +139,10 @@ class MsgText(Enum):
{config_file}
"""
ConfigUpdated = """
Configuration updated to newest version at {config_path}
"""
# --- Password --- #
PasswordMaxTriesExceeded = """
Too many attempts with wrong password