Permalink
Browse files

Use rlwrap, where available, for repl (like Leiningen).

  • Loading branch information...
1 parent 2aa8b3e commit 3ffe768bb032a6269fe5f9541fa5a122bac59f4e @trptcolin committed Apr 14, 2011
Showing with 18 additions and 1 deletion.
  1. +18 −1 script/repl
View
@@ -5,4 +5,21 @@ for f in lib/*.jar; do
CLASSPATH=$CLASSPATH:$f
done
-java -Xmx1G -cp $CLASSPATH jline.ConsoleRunner clojure.main -i script/run.clj -r
+RLWRAP=`which rlwrap`
+if [ ! -x "$RLWRAP" ] || [ "$RLWRAP" = "" ]; then
+ RLWRAP=""
+ JLINE=jline.ConsoleRunner
+ if [ "$OSTYPE" = "cygwin" ]; then
+ JLINE="-Djline.terminal=jline.UnixTerminal jline.ConsoleRunner"
+ CYGWIN_JLINE=y
+ fi
+else
+ JLINE=""
+ # Test to see if rlwrap supports custom quote chars
+ rlwrap -m -q '"' echo "hi" > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ RLWRAP="$RLWRAP -m -q '\"'"
+ fi
+fi
+
+$RLWRAP java -Xmx1G -cp $CLASSPATH $JLINE clojure.main -i script/run.clj -r

0 comments on commit 3ffe768

Please sign in to comment.