Revision: 15328
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 1, 2009 03:06 by phalkunz
Initial Code
#!/usr/bin/python """ Author: Saophalkun Ponlu (http://phalkunz.com) Contact: [email protected] Date: May 23, 2009 Modified: June 15, 2009 """ import sys import re import os import subprocess def getCommandParameters(): parameters = '' for i in range(1, sys.argv.__len__()): parameters += sys.argv[i] + " " return parameters def matchStatusColorAndPrint(line): statusColors = { "M": "31", # red "\?": "32", # green "A": "32", # green "C": "30;41", # black on red "-": "31", "\+": "32", } for color in statusColors: match = re.match(color, line) if match: os.popen("echo '\E[" + statusColors[color] + "m" + line + "\E[m'", 'w') return True os.popen("echo \"" + line + "\"", 'w') def escapeSpecialChars(line): return line.replace('$', '\$') if __name__ == "__main__": parameters = getCommandParameters(); output = subprocess.Popen('svn ' + parameters, shell=True, stdout=subprocess.PIPE); while True: line = output.stdout.readline() if not line: break escapedLine = escapeSpecialChars(line.strip()) matchStatusColorAndPrint(escapedLine)
Initial URL
Initial Description
Improved version of http://snipplr.com/view/15246/color-coded-svn-status/
Initial Title
Color coded SVN status (v.2)
Initial Tags
svn
Initial Language
Bash