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

View file

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