简体   繁体   English

如何破解IntelliJ Idea命令行启动器脚本以在独立窗口中打开文件并等待关闭?

[英]How can I hack the IntelliJ Idea Command-line Launcher script to open a file in an independent window and wait for close?

IntelliJ has a built in Command-line Launcher script that, by default on Mac OS, installs a Python file to /usr/local/bin/idea . IntelliJ具有内置的命令行启动器脚本,默认情况下,在Mac OS上,该脚本将Python文件安装到/usr/local/bin/idea By examining this file, I was able to find a cool way to launch a file in it's own temporary project (ie, idea --temp-project myfile.txt ). 通过检查该文件,我找到了一种在其自己的临时项目中启动文件的绝妙方法(即idea --temp-project myfile.txt )。 What I'd like to do next, is find a way to wait on the project closing. 接下来,我想找到一种等待项目结束的方法。

Again, by examining the Python code, this would seem to depend (at least when IntelliJ is already open, which is my typical usage) upon a socket call activate ... (line 88 in the script on my system). 同样,通过检查Python代码,这似乎取决于(至少当IntelliJ已打开时,这是我的典型用法)取决于socket调用activate ... (系统脚本中的第88行)。 At the top of the file, there's a comment that says see com.intellij.idea.SocketLock for the server side of this interface which can be found here . 在该文件的顶部,有一条注释,指出see com.intellij.idea.SocketLock for the server side of this interface ,可在此处找到。 Unfortunately, I can't seem to figure out the IntelliJ socket API from this file. 不幸的是,我似乎无法从该文件中找出IntelliJ套接字API。

Does anyone have a link to documentation or otherwise know a way to hack this, with the goal of basically waiting on the call until the temporary project is closed? 是否有人链接到文档或以其他方式知道破解此方法的目的,目的是基本上等待呼叫直到临时项目关闭?

Edit: I'm using IntelliJ Idea Ultimate 2019.1.3 on Mac OS Mojave 10.14.5 编辑:我在Mac OS Mojave 10.14.5上使用IntelliJ Idea Ultimate 2019.1.3

Command line launcher --wait key is supported since 2019.2. 从2019.2。开始支持命令行启动器--wait键。 Running idea --temp-project --wait myfile.txt should do exactly what you want: open a file, block cmdline until the file is opened in IDE. 运行idea --temp-project --wait myfile.txt应该完全符合您的要求:打开文件,阻止cmdline,直到在IDE中打开该文件。

NB: this does not work for Toolbox+Mac, as Toolbox creates incompatible launcher. 注意:这不适用于Toolbox + Mac,因为Toolbox创建了不兼容的启动器。

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

相关问题 如何将脚本输出写入文件和命令行? - How to write script output to file and command-line? 如何从命令行Python脚本中保存LibreOffice Calc电子表格中的所有工作表 - How can I save ALL sheets in a LibreOffice Calc Spreadsheet from a command-line Python script 如何通过命令行将参数赋予python脚本功能? - How can I give parameters to a function of a python script through the command-line? 我可以在配置文件中放置鼻子测试命令行选项吗? - Can I put nosetests command-line options in a configuration file? 如何使用 vanila python 在命令行上获取 arguments? - How can I get the arguments on a command-line with vanila python? 如何使用 argparse 将列表作为命令行参数传递? - How can I pass a list as a command-line argument with argparse? 如何在python(类)中发出命令以打开第二个 window 并关闭主 window - How can I make a command to open second window and close the main window in python(class) 如何在Python脚本中从命令行打开窗口? - How to open a window from the command line within a Python script? 如何使用子进程库在顶级python文件中使用命令行参数调用其他python文件? - How can I use the subprocess library to call other python files with command-line arguments in a top-level python file? 如何使 pudb 中的命令行/解释器窗格/窗口变大? - How to make the command-line / interpreter pane/window bigger in pudb?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM