def wrapper(): try: # call the command method(parser) except Exception, e: print print styled("*** error: %s" % str(e), attrs=["red"]) raise
def required_style(msg): return styled(" %s " % msg, attrs=["reverse"])
def header(msg, attrs): attrs += ["bold"] padding = styled(" "*8 + " "*len(msg), attrs=attrs) padded_message = styled(" "*4 + msg + " "*4, attrs=attrs) return "%s\n%s\n%s" % (padding, padded_message, padding)
def result_style(msg): return styled(" %s " % msg, attrs=["bgmagenta", "white"])
def optional_style(msg): return styled(" %s " % msg, attrs=["reverse"])
def print_command(name, description): print styled(format_string % dict(name=name), attrs=["bold"]), description
def header(msg, attrs): attrs += ["bold"] padding = styled(" " * 8 + " " * len(msg), attrs=attrs) padded_message = styled(" " * 4 + msg + " " * 4, attrs=attrs) return "%s\n%s\n%s" % (padding, padded_message, padding)