diff --git a/jrnl/messages.py b/jrnl/messages.py index ae359d15..f8ea47f4 100644 --- a/jrnl/messages.py +++ b/jrnl/messages.py @@ -227,6 +227,12 @@ class MsgText(Enum): KeyringRetrievalFailure = "Failed to retrieve keyring" + # --- Deprecation --- # + DeprecatedCommand = """ + The command {old_cmd} is deprecated and will be removed from jrnl soon. + Please use {new_cmd} instead. + """ + class Message(NamedTuple): text: MsgText diff --git a/jrnl/output.py b/jrnl/output.py index 1a8e7fb1..8386f769 100644 --- a/jrnl/output.py +++ b/jrnl/output.py @@ -19,13 +19,13 @@ from jrnl.messages import MsgText def deprecated_cmd(old_cmd, new_cmd, callback=None, **kwargs): - warning_msg = f""" - The command {old_cmd} is deprecated and will be removed from jrnl soon. - Please use {new_cmd} instead. - """ - warning_msg = textwrap.dedent(warning_msg) - logging.warning(warning_msg) - print(f"{WARNING_COLOR}{warning_msg}{RESET_COLOR}", file=sys.stderr) + print_msg( + Message( + MsgText.DeprecatedCommand, + MsgType.WARNING, + {"old_cmd": old_cmd, "new_cmd": new_cmd}, + ) + ) if callback is not None: callback(**kwargs)