stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[STUMP] [PATCH] [stumpish] prepending a fixed string to each command


From: 38a938c2
Subject: [STUMP] [PATCH] [stumpish] prepending a fixed string to each command
Date: Mon, 25 Aug 2008 00:14:56 +0400
User-agent: Thunderbird 2.0.0.14 (X11/20080804)

The assumed purpose is prepending "eval" to each line to get an
easy-to-use CLisp REPL to StumpWM.
>From 691d0b3b0330b2832e99eab9769f7b50b9742f9a Mon Sep 17 00:00:00 2001
From: 38a938c2 <address@hidden>
Date: Mon, 25 Aug 2008 00:12:36 +0400
Subject: [PATCH] Added possibility to prepend a fixed prefix to each command

---
 contrib/stumpish |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/contrib/stumpish b/contrib/stumpish
index 1d48bb4..8bb0661 100755
--- a/contrib/stumpish
+++ b/contrib/stumpish
@@ -100,6 +100,11 @@ then
     shift 1
 fi
 
+if [ "x$1" = "x-prefix" ]; then
+    export STUMPISH_COMMAND_PREFIX="$2 ";
+    shift 2;
+fi;
+
 if [ $# -gt 0 ]
 then
     [ "$1" = "--help" ] && usage
@@ -134,12 +139,16 @@ else
 
        tput setaf 5
         echo Welcome to the STUMPwm Interactive SHell.
-        tput sgr0
-        echo -n 'Type '
-        tput setaf 2
-        echo -n commands
-        tput sgr0
-        echo \ for a list of commands.
+       if [ -z "$STUMPISH_COMMAND_PREFIX" ]; then 
+            tput sgr0
+            echo -n 'Type '
+            tput setaf 2
+            echo -n commands
+            tput sgr0
+            echo \ for a list of commands.
+       else
+           echo "Every command will be prepended with 
\`$STUMPISH_COMMAND_PREFIX'";
+       fi;
 
         IFS='
 '
@@ -148,7 +157,7 @@ else
        do
            tput bold
            tput setaf 2
-           send_cmd "$REPLY"
+           send_cmd "$STUMPISH_COMMAND_PREFIX$REPLY"
            tput sgr0
 
            echo -n "> "
-- 
1.6.0


reply via email to

[Prev in Thread] Current Thread [Next in Thread]