changeset 11:82176b2a61da

Various tweaks to sh-replay
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Sat, 08 Mar 2014 21:31:00 -0500
parents 80b765f69c5f
children 21e4397ee222
files sh-replay
diffstat 1 files changed, 25 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/sh-replay	Sat Mar 08 21:29:42 2014 -0500
+++ b/sh-replay	Sat Mar 08 21:31:00 2014 -0500
@@ -51,9 +51,23 @@
 
     hg_id = get_hg_id()
 
-    sys.stdout.write(yellow("jordi@REVSETS", style="bold") + ":"
+    sys.stdout.write(yellow("jordi@evolve", style="bold") + ":"
                      + blue(cwd, style="bold") + " "
-                     + magenta(hg_id, style="bold") + "$ ")
+                     + magenta(hg_id, style="bold") + "\n$ ")
+
+def waitforenter():
+    while True:
+        key = getch()
+        if ord(key) == 13:
+            sys.stdout.write("\n")
+            sys.stdout.flush()
+            break
+
+def backtoslides():
+    print
+    print "    <---- Back to slides    "
+    print
+    waitforenter()
 
 def main():
     subprocess.call("reset")
@@ -64,6 +78,14 @@
     global curr_cmd
     for cmd in cmds:
         print_prompt()
+
+        # Control commands...
+        if cmd[0] == "!":
+            cmd = cmd[1:]
+            if cmd == "RET":
+                backtoslides()
+            continue
+
         curr_cmd = ""
         for c in cmd:
             key = getch()
@@ -71,12 +93,7 @@
             sys.stdout.flush()
             curr_cmd += c
 
-        while True:
-            key = getch()
-            if ord(key) == 13:
-                sys.stdout.write("\n")
-                sys.stdout.flush()
-                break
+        waitforenter()
 
         if cmd.startswith("cd "):
             cd(cmd[3:])
@@ -88,36 +105,6 @@
 
             subprocess.call(["/bin/bash", "-l", "/tmp/cmd"])
 
-    while True:
-        key = getch()
-        if ord(key) == 13:
-            sys.stdout.write("\n")
-            sys.stdout.flush()
-            break
-
-    print
-    print
-    print
-    print
-    print
-    print
-    print
-    print
-    print yellow("    TTTTTT HH HH      A     NN   NN  KK  KK   SSS ", style="bold")
-    print yellow("      TT   HH HH     A A    NNNN NN  KK KK   SS   ", style="bold")
-    print yellow("      TT   HHHHH    AAAAA   NN NNNN  KKKKK    SS  ", style="bold")
-    print yellow("      TT   HH HH   AA   AA  NN  NNN  KK KK     SS ", style="bold")
-    print yellow("      TT   HH HH  AA     AA NN   NN  KK  KK  SSS  ", style="bold")
-    print
-    print
-    print
-    print
-    print
-    print
-    print
-    print
-
 
 if __name__ == "__main__":
     main()
-