Add check for tclreadline package and terminal color support.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Fri, 30 Aug 2013 00:28:47 +0300
changeset 634 89a1a77ad559
parent 633 ef2436c18276
child 635 799341bb0ea7
Add check for tclreadline package and terminal color support.
.tclshrc
--- a/.tclshrc	Fri Aug 30 00:26:29 2013 +0300
+++ b/.tclshrc	Fri Aug 30 00:28:47 2013 +0300
@@ -1,6 +1,15 @@
 # -*- mode: tcl -*-
 
 if {$tcl_interactive} {
-    package require tclreadline
-    ::tclreadline::Loop
+    catch {
+        package require tclreadline
+        namespace eval tclreadline {
+            if ([regexp "^(xterm|eterm-color)" "$::env(TERM)"]) {
+                proc prompt1 {} { return "\[0;31m\[1mtcl>\[0m " }
+            } {
+                proc prompt1 {} { return "tcl> " }
+            }
+        }
+        ::tclreadline::Loop
+    }
 }