cli: Add verbose and noln parameters to error() and status()
This commit is contained in:
@@ -118,15 +118,17 @@ class CLI(pisi.ui.UI):
|
||||
else:
|
||||
self.output(pisi.util.colorize(msg + '\n', 'brightyellow'), err=True, verbose=verbose)
|
||||
|
||||
def error(self, msg):
|
||||
def error(self, msg, noln = False):
|
||||
msg = unicode(msg)
|
||||
self.errors += 1
|
||||
if not noln:
|
||||
msg = '%s\n' % msg
|
||||
if ctx.log:
|
||||
ctx.log.error(msg)
|
||||
if ctx.get_option('no_color'):
|
||||
self.output(_('Error: ') + msg + '\n', err=True)
|
||||
self.output(_('Error: ') + msg, err=True)
|
||||
else:
|
||||
self.output(pisi.util.colorize(msg + '\n', 'brightred'), err=True)
|
||||
self.output(pisi.util.colorize(msg, 'brightred'), err=True)
|
||||
|
||||
def action(self, msg, verbose = False):
|
||||
#TODO: this seems quite redundant?
|
||||
@@ -184,10 +186,10 @@ class CLI(pisi.ui.UI):
|
||||
if ka['percent'] == 100:
|
||||
self.output(pisi.util.colorize(_(' [complete]\n'), 'gray'))
|
||||
|
||||
def status(self, msg = None):
|
||||
def status(self, msg = None, verbose = False):
|
||||
if msg:
|
||||
msg = unicode(msg)
|
||||
self.output(pisi.util.colorize(msg + '\n', 'brightgreen'))
|
||||
self.output(pisi.util.colorize(msg + '\n', 'brightgreen'), verbose=verbose)
|
||||
pisi.util.xterm_title(msg)
|
||||
|
||||
def notify(self, event, **keywords):
|
||||
|
||||
+2
-2
@@ -68,7 +68,7 @@ class UI(object):
|
||||
"warn the user"
|
||||
pass
|
||||
|
||||
def error(self,msg):
|
||||
def error(self, msg, noln = False):
|
||||
"inform a (possibly fatal) error"
|
||||
pass
|
||||
|
||||
@@ -90,7 +90,7 @@ class UI(object):
|
||||
"display progress"
|
||||
pass
|
||||
|
||||
def status(self, msg = None):
|
||||
def status(self, msg = None, verbose = False):
|
||||
"set status, if not given clear it"
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user