From 2df7419ac1416f15a331a6f9cb18c3137e8ddbc6 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Sun, 1 May 2022 03:58:02 -0700 Subject: [PATCH] update install module to use new message function --- jrnl/install.py | 8 ++++---- jrnl/messages.py | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/jrnl/install.py b/jrnl/install.py index f8322fba..340fd16a 100644 --- a/jrnl/install.py +++ b/jrnl/install.py @@ -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 diff --git a/jrnl/messages.py b/jrnl/messages.py index c21bb520..6b3d9b52 100644 --- a/jrnl/messages.py +++ b/jrnl/messages.py @@ -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