.pystartup
changeset 227 d2bb2c3da51b
parent 226 97139da73273
child 311 a63540742a19
--- a/.pystartup	Fri Oct 14 15:24:08 2011 +0300
+++ b/.pystartup	Fri Oct 14 15:46:47 2011 +0300
@@ -6,8 +6,9 @@
 # Store the file in ~/.pystartup, and set an environment variable to point
 # to it:  "export PYTHONSTARTUP=~/.pystartup" in bash.
 
+import os
+import sys
 import atexit
-import os
 import readline
 import rlcompleter
 
@@ -20,6 +21,15 @@
 if os.path.exists(historyPath):
     readline.read_history_file(historyPath)
 
+term_with_colors = ['xterm', 'xterm-color', 'xterm-256color', 'linux', 'screen', 'screen-256color', 'screen-bce']
+if os.environ.get('TERM') in term_with_colors:
+    green='\033[32m'
+    red='\033[31m'
+    reset='\033[0m'
+    sys.ps1 = red + '>>> ' + reset
+    sys.ps2 = green + '... ' + reset
+del term_with_colors
+
 atexit.register(save_history)
-del os, atexit, readline, rlcompleter, save_history, historyPath
+del os, sys, atexit, readline, rlcompleter, save_history, historyPath