Conditions | 2 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import logging |
||
4 | def deprecated_cmd(old_cmd, new_cmd, callback=None, **kwargs): |
||
5 | import sys |
||
6 | import textwrap |
||
7 | |||
8 | from .color import RESET_COLOR |
||
9 | from .color import WARNING_COLOR |
||
10 | |||
11 | warning_msg = f""" |
||
12 | The command {old_cmd} is deprecated and will be removed from jrnl soon. |
||
13 | Please use {new_cmd} instead. |
||
14 | """ |
||
15 | warning_msg = textwrap.dedent(warning_msg) |
||
16 | logging.warning(warning_msg) |
||
17 | print(f"{WARNING_COLOR}{warning_msg}{RESET_COLOR}", file=sys.stderr) |
||
18 | |||
19 | if callback is not None: |
||
20 | callback(**kwargs) |
||
21 | |||
34 |