def set_prompt(self, username, breadcrumbs): c_pri = color.set('green') c_un = color.set('cyan') c_d = color.set('green') self.prompt = c_pri + 'CS ' + c_un + username + \ c_pri + ' ' + ' > '.join(breadcrumbs) + \ c_d + '$ ' + color.clear()
def do_colortest(self, s): for name in color.color_codes.keys(): print "% 4s %s% 6s" % ('', color.set(name), name), print color.clear(), 'bg:', for x in color.color_codes.keys(): print "%s% 6s" % (color.set(x, bg=name), x), print color.clear() print "% 4s %s% 6s" % ('bold', color.set(name, bold=True), name), print color.clear(), 'bg:', for x in color.color_codes.keys(): print "%s% 6s" % (color.set(x, bold=True, bg=name), x), print color.clear()
def __init__(self, lb_shell, lb): base_shell.__init__(self) self.lb_shell = lb_shell self.set_prompt(self.lb_shell.main_shell.username, ['Load Balancer', self.lb_shell.region, lb.name]) self.lb = lb self.intro = color.set('yellow') + "If you make any updates, they are" + \ " not finalized until you run update or commit" + color.clear()
def notice(self, text, *args): c_notice = color.set('green') text += ' ' + ' '.join(args) print c_notice, text, color.clear()
def warning(self, text, *args): c_warn = color.set('yellow', bold=True) text += ' ' + ' '.join(args) print c_warn, text, color.clear()
def alert(self, text, *args): c_alert = color.set('red') text += ' ' + ' '.join(args) print c_alert, text, color.clear()
def error(self, text, *args): c_error = color.set('purple', bold=True) text += ' ' + ' '.join(args) print c_error, "Error:", text, color.clear()