diff --git a/pubs/color.py b/pubs/color.py index ef22452..f00d1f9 100644 --- a/pubs/color.py +++ b/pubs/color.py @@ -3,6 +3,7 @@ Small code to handle colored text """ import sys import re +import os def _color_supported(stream): """Returns True is the stream supports colors""" diff --git a/pubs/uis.py b/pubs/uis.py index 2db2cbd..07f45c9 100644 --- a/pubs/uis.py +++ b/pubs/uis.py @@ -58,6 +58,10 @@ class PrintUI(object): kwargs['file'] = self._stdout print(*messages, **kwargs) + def info(self, message, **kwargs): + kwargs['file'] = self._stderr + print('{}: {}'.format(color.dye_err('info', 'ok'), message), **kwargs) + def warning(self, message, **kwargs): kwargs['file'] = self._stderr print('{}: {}'.format(color.dye_err('warning', 'warning'), message), **kwargs) diff --git a/pubs/utils.py b/pubs/utils.py index 3e08b6f..76c582c 100644 --- a/pubs/utils.py +++ b/pubs/utils.py @@ -15,7 +15,7 @@ def resolve_citekey(repo, citekey, ui=None, exit_on_fail=True): elif len(citekeys) == 1: if citekeys[0] != citekey: if ui is not None: - ui.warning("Provided citekey '{}' has been autocompleted into '{}'".format(color.dye_out(citekey, 'citekey'), color.dye_out(citekeys[0], 'citekey'))) + ui.info("Provided citekey '{}' has been autocompleted into '{}'".format(color.dye_out(citekey, 'citekey'), color.dye_out(citekeys[0], 'citekey'))) citekey = citekeys[0] elif citekey not in citekeys: if ui is not None: