#!/usr/bin/python

import curses

curses.setupterm()

color_normal = curses.tigetstr('sgr0')
color_green = curses.tparm(curses.tigetstr('setaf'), curses.COLOR_GREEN)
color_blue = curses.tparm(curses.tigetstr('setaf'), curses.COLOR_BLUE)
color_magenta = curses.tparm(curses.tigetstr('setaf'), curses.COLOR_MAGENTA)
color_red = curses.tparm(curses.tigetstr('setaf'), curses.COLOR_RED)

bold = curses.tparm(curses.tigetstr('bold'), curses.A_BOLD)
underline = curses.tparm(curses.tigetstr('smul'), curses.A_UNDERLINE)

markup = {
    'red' : color_red,
    'green' : color_green,
    'blue' : color_blue,
    'magenta' : color_magenta,

    'b' : bold,
    'u' : underline,
} 


def convert(in_string):
    out_string = in_string
    for k, v in markup.items():
        out_string = out_string.replace("[%s]" % k, v)
        out_string = out_string.replace("[/%s]" % k, color_normal)

    return out_string

if __name__ == "__main__":
    import sys
    if len(sys.argv) > 1:
        print convert(" ".join(sys.argv[1:]))
    else:
        for line in sys.stdin:
            sys.stdout.write(convert(line))

@@ -965,16 +965,260 @@
 v) %3E 1:%0A
+        if sys.argv%5B1%5D == %22--help%22:%0A            print %22Usage: %25s %5B--funky%5D %5B--bunch%5D TEXT%22 %25 sys.argv%5B0%5D%0A            sys.exit(0)%0A        elif sys.argv%5B1%5D in %5B%22--funky%22, %22--bunch%22%5D:%0A            print %22TODO: implement me%22%0A            sys.exit(0)%0A
         

Add --funky and --bunch stubs