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 sys
|
||||||
import re
|
import re
|
||||||
|
import os
|
||||||
|
|
||||||
def _color_supported(stream):
|
def _color_supported(stream):
|
||||||
"""Returns True is the stream supports colors"""
|
"""Returns True is the stream supports colors"""
|
||||||
|
@ -58,6 +58,10 @@ class PrintUI(object):
|
|||||||
kwargs['file'] = self._stdout
|
kwargs['file'] = self._stdout
|
||||||
print(*messages, **kwargs)
|
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):
|
def warning(self, message, **kwargs):
|
||||||
kwargs['file'] = self._stderr
|
kwargs['file'] = self._stderr
|
||||||
print('{}: {}'.format(color.dye_err('warning', 'warning'), message), **kwargs)
|
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:
|
elif len(citekeys) == 1:
|
||||||
if citekeys[0] != citekey:
|
if citekeys[0] != citekey:
|
||||||
if ui is not None:
|
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]
|
citekey = citekeys[0]
|
||||||
elif citekey not in citekeys:
|
elif citekey not in citekeys:
|
||||||
if ui is not None:
|
if ui is not None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user