diff --git a/src/sshare/cli.py b/src/sshare/cli.py index 87af8be..ddf7794 100644 --- a/src/sshare/cli.py +++ b/src/sshare/cli.py @@ -14,6 +14,8 @@ import argparse import getpass +import importlib +import importlib.util import os import os.path import pyclip @@ -89,6 +91,17 @@ def rebase(number): def main(): + module_spec = importlib.util.spec_from_file_location( + "logger_cli", + "/home/gnarwhal/meine/projects/active/sshare/src/sshare/plugins/logger_cli.py" + ) + module = importlib.util.module_from_spec(module_spec) + module_spec.loader.exec_module(module) + + module.log("test?") + module.warn("test?") + module.error("test?") + arguments = parse_arguments() config = Config() diff --git a/src/sshare/plugins/logger_cli.py b/src/sshare/plugins/logger_cli.py new file mode 100644 index 0000000..42ba723 --- /dev/null +++ b/src/sshare/plugins/logger_cli.py @@ -0,0 +1,25 @@ +# This file is part of SSHare. +# +# SSHare is free software: you can redistribute it and/or modify it under the terms of +# the GNU General Public License as published by the Free Software Foundation, +# either version 3 of the License, or (at your option) any later version. +# +# SSHare is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# SSHare. If not, see . + +def _print_with_color(color, message): + print(f"\033[{color}m{message}\033[0m") + +def log(message): + _print_with_color(0, message) + +def warn(message): + _print_with_color(93, message) + +def error(message): + _print_with_color(91, message)