added ui.info() and made it default for citekey completion
This commit is contained in:
parent
a926c4c654
commit
69b2879fa2
@ -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"""
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user