3 import sys, os, string, time
5 locale.setlocale(locale.LC_ALL,"")
7 #some default definitions
10 'default' : "\033[0m",
12 'underline' : "\033[4m",
14 'reverse' : "\033[7m",
15 'concealed' : "\033[8m",
20 'yellow' : "\033[33m",
22 'magenta' : "\033[35m",
26 'on_black' : "\033[40m",
27 'on_red' : "\033[41m",
28 'on_green' : "\033[42m",
29 'on_yellow' : "\033[43m",
30 'on_blue' : "\033[44m",
31 'on_magenta' : "\033[45m",
32 'on_cyan' : "\033[46m",
33 'on_white' : "\033[47m",
39 timeformat = "%a %b %d %H:%M:%S %Y"
40 delim1 = colours["bold"]+colours["red"] # before time string
41 delim2 = colours["default"]+colours["yellow"]+":" # after time string
42 delim3 = ": "+colours["default"] # before command
43 delim4 = colours["default"] # at the end of line
44 delim5 = colours["bold"]+colours["blue"] # before unrecognized line format
47 for i in [ os.environ['HOME']+"/.zsh/misc/zshistrc"]:
53 historyfile = sys.argv[1]
54 if os.path.isdir(historyfile):
55 historyfile = historyfile + "/.zsh/history"
57 historyfile = os.environ['HOME']+"/.zsh/history"
59 f = open(historyfile,"r")
63 s1 = string.split(i, ":",2)
65 s2 = string.split(s1[2], ";", 1)
67 commandstring = s2[1][:-1]
68 t = long(timestring) # seconds since the epoch
69 print delim1+time.strftime(timeformat,time.localtime(t))+delim2+delaystring+delim3+commandstring+delim4
71 print delim5+i[:-1]+delim4