In IntelliJ IDEA, how can I create a key binding that executes a shell script with the current file as a parameter?

偶尔善良 提交于 2019-12-08 17:28:30

问题


In IntelliJ IDEA, how can I create a key binding that executes a shell script with the current file as a parameter?

For exanmple, if I am in a test file (entity.spec.js), I want to save and hit a key binding to trigger a shell script with that file as the parameter:

./run_test.sh /full/path/to/entity.spec.js

Any idea how to do that?


回答1:


You can do it using the External Tools. Then you can assign a keyboard shortcut to your tool in Settings | Keymap.

Please note that you should specify your shell interpreter as a Program for the external tool (such as /bin/bash) and pass your script path and the file name as Parameters. Use Insert Macro button to add a macro for the current editor file path.



来源:https://stackoverflow.com/questions/7622075/in-intellij-idea-how-can-i-create-a-key-binding-that-executes-a-shell-script-wi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!