我有一个用例,当我在终端上运行以下命令时 -
node --debug-brk --inspect Javascript.js
它在调试模式下运行node.js并输出一个可以在chrome中打开以进行调试的URL -
➜ temp node --debug-brk --inspect Javascript.js
Debugger listening on port 9229.
Warning: This is an experimental feature and could change at any time.
To start debugging, open the following URL in Chrome:
chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/e7aae1e7-7952-41a4-9fe1-6bead23b791d
我在I term中为chrome\-devtools.*$
创建了一个触发器,并将命令设置为
open -a "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \0
这样网址会自动以chrome格式打开,但遗憾的是它不起作用。
答案 0 :(得分:1)
您必须解决两个问题:
Chrome通过cmd行参数传递时无法将chrome-devtools://...
识别为有效网址,并尝试将其作为文件方案链接打开,从而失败
Chrome不会为chrome-devtools://
注册macOS操作系统的网址方案,因此您无法 open
首先,将chrome-devtools://
注册为有效的URL方案。有几种方法可以做到这一点,这只是一个:
LinCastor
(https://onflapp.wordpress.com/lincastor/),注册chrome-devtools
作为使用Chrome打开该计划的方案:其次,在任何open
正则表达式匹配项中添加iTerm触发器以使用chrome\-devtools.*$
:
由于您已注册了URL方案,因此如果您为该规则添加CMD-click
和操作,也可以通过iTerm窗口中的Smart Selection Rule
打开它: