summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xnoise39
1 files changed, 30 insertions, 9 deletions
diff --git a/noise b/noise
index fe67052c..048726f2 100755
--- a/noise
+++ b/noise
@@ -40,13 +40,28 @@ cleanup() {
kill $jobs
}
+
+qname="`readlink -f "$0"`"
+dirname="`dirname "$qname"`"
+if test -d "$dirname/modules" ; then
+ export NOISE_PATH="${NOISE_PATH+$NOISE_PATH:}$dirname/modules"
+fi
linefeed="/tmp/noise-client-$$"
trap cleanup EXIT
mkfifo $linefeed
-while eval `{ read && echo $REPLY ; } | tr -d \' | sed -rn "
- s:^/([a-z]+)([[:space:]]+(.*))?$:command='\1'; args='\3';:p;t
- s:.*:command='$noise_default_command'; args='&';:p;t
- "` ; do
+##
+##
+##
+readline() {
+ { read && echo $REPLY ; } | sed -rn "
+ s/['\"]//g
+ s:^/([a-z]+)([[:space:]]+(.*))?$:command=\1; args='\3';:p;t
+ s@^([[:alnum:]_/+-]+):[[:space:]]*(.*)@command=lang; args='\1 \2';@p;t
+ s@^\![[:space:]]*(.*)@command=play; args='\1';@p;t
+ s:.*:command='$noise_default_command'; args='&';:p;t
+ "
+}
+while eval "`readline`" ; do
#echo "command: $command; args: $args"
## modcall
for dir in `echo "$NOISE_PATH" | tr : \ ` ; do
@@ -66,18 +81,24 @@ while eval `{ read && echo $REPLY ; } | tr -d \' | sed -rn "
fail unknown command "$command"
done <$linefeed &
jobs="${jobs+$jobs }`jobs -p`"
+##
+##
+##
cat<<EOF
welcome to SHACK UTTERANCE version 0.9 beta 2
get help with /help
TIP: benutze rlwrap für eine elitäre Kommandozeile.
EOF
+##
+##
+##
exec >>$linefeed
echo /set default_command espeak
- while read ; do
- case $REPLY in
- (/quit) echo /quit ; exit ;;
- (*) tr \; \\n | grep . ;;
- esac<<EOF
+while read ; do
+ case $REPLY in
+ (/quit) echo /quit ; exit ;;
+ (*) tr \; \\n | grep . ;;
+ esac<<EOF
$REPLY
EOF
done