2012-10-05 43 views
2

是否有一個簡短的sbt命令或鍵盤快捷鍵來重新調用最後發出的命令?我發現自己必須反覆執行此操作:重複上一次sbt命令?

> test-only my.long.package.etc.class.name 

複製+粘貼有點煩人。我在IntelliJ IDEA中使用sbt控制檯,因此向上滾動瀏覽歷史記錄不起作用。

+2

sbt插件的最新版本確實有歷史向上箭頭。 https://groups.google.com/forum/?fromgroups=#!topic/simple-build-tool/SSt47q8EaOI –

+0

@Luigi - 謝謝,我已經降級到1.3,因爲我無法忍受新的垂直分割線四處走動,而我在滾動條上遇到了問題。不過,我找到了解決辦法,所以我願意回到1.4。因此,如果您將其作爲答案發布,我會接受。另一方面,有一個非常簡單的解決方案,它是'〜test-only my.long.package.etc.class.name',它在調整和保存後將重新運行測試。 –

回答

2

升級到SBT插件的最新版本1.4.0 IDEA,因爲它支持箭頭鍵歷史記錄。

12

你想要!!。要查看sbt幫助,類型help在提示符下:

> help 

    help       Displays this help message or prints detailed help on requested commands (run 'help <command>'). 
    about      Displays basic information about sbt and the build. 
    reload      (Re)loads the project in the current directory 
    settings      Lists the settings defined for the current project. 
    tasks      Lists the tasks defined for the current project. 
    projects      Lists the names of available projects or temporarily adds/removes extra builds to the session. 
    project      Displays the current project or changes to the provided `project`. 
    set       Evaluates a Setting and applies it to the current project. 
    session      Manipulates session settings. For details, run 'help session'. 
    inspect      Prints the value for 'key', the defining scope, delegates, related definitions, and dependencies. 
    ; <command> (; <command>)* Runs the provided semicolon-separated commands. 
    ~ <command>     Executes the specified command whenever source files change. 
    last       Displays output from a previous command or the output from a specific task. 
    last-grep     Shows lines from the last output for 'key' that match 'pattern'. 
    exit       Terminates the build. 
    show <key>     Displays the result of evaluating the setting or task associated with 'key'. 

More command help available using 'help <command>' for: 
    !, -, <, alias, append, apply, eval, iflast, reboot, shell 

,然後得到幫助的!

> ! 
History commands: 
    !! Execute the last command again 
    !: Show all previous commands 
    !:n Show the last n commands 
    !n Execute the command with index n, as shown by the !: command 
    !-n Execute the nth command before this one 
    !string Execute the most recent command starting with 'string' 
    !?string Execute the most recent command containing 'string' 
+0

不幸的是'!x'歷史命令在IDEA插件中無法正常工作;與JLine有關 –

+0

當!噢,好吧... –

+0

好的,我試過'幫助!',它給了我什麼。不幸的是@LuigiPlinge指出,你只會在IDEA中得到'[error]無效的歷史索引:X''。 –