简体   繁体   English

如何让“lein repl”历史在cygwin中运行?

[英]How can I get the “lein repl” history to work in cygwin?

I'm using Cygwin on Windows 7 and the latest lein, but when I am in the repl, pressing up and down moves me around the repl console instead of showing me history (which is what I expect). 我在Windows 7上使用Cygwin和最新的lein,但是当我在repl中时,上下按下让我绕着repl控制台而不是向我展示历史(这是我期望的)。 I've googled around and seen that this is related to using jline instead of readline (whatever that means) but I don't know how to use this information to fix my problem. 我已经google了一下,看到这与使用jline而不是readline(无论这意味着什么)有关,但我不知道如何使用这些信息来解决我的问题。

I found the answer here: 我在这里找到了答案:

I modified the lein startup script to call stty and set jline.terminal, and it seems to work: 我修改了lein启动脚本来调用stty并设置jline.terminal,它似乎工作:

stty -icanon min 1 -echo
$LEIN_JAVA_CMD \
    -client -XX:+TieredCompilation \
    -Djline.terminal=jline.UnixTerminal \
    $LEIN_JVM_OPTS \
    -Dfile.encoding=UTF-8 \
    -Dmaven.wagon.http.ssl.easy=false \
    -Dleiningen.original.pwd="$ORIGINAL_PWD" \
    -Dleiningen.trampoline-file="$TRAMPOLINE_FILE" \
    -cp "$CLASSPATH" \
    clojure.main -m leiningen.core.main "$@"
EXIT_CODE=$?
stty icanon echo

I modified that section in the lein script and now up = history. 我修改了lein脚本中的那个部分,现在up = history。

An alternative approach to the one you suggested would be to install rlwrap which is available in Cygwin. 另一种方法给你建议将安装一个rlwrap它可在Cygwin中。 This will give you Readline capabilities (eg. command history search and navigation) to any interactive command line application. 这将为您提供任何交互式命令行应用程序的Readline功能(例如,命令历史记录搜索和导航)。 If you've used bash for any length of time you will know what these capabilities are. 如果你已经使用bash任何时间长度,你将知道这些功能是什么。

You will need to start the applications as parameters to the readline wrapper but this can be hidden away using aliases or functions as appropriate: 您需要将应用程序作为参数启动到readline包装器,但可以使用别名或函数将其隐藏起来:

rlwrap lein repl

The benefit of using rlwrap over your suggestion is that it can add this capabilities to more than just the specific case of the repl. 使用rlwrap优于您的建议的好处是它可以将此功能添加到不仅仅是repl的特定情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM