xml - 用于修改 JetBrains 项目中 .idea 文件夹中 XML 的命令行工具

标签 xml intellij-idea webstorm jetbrains-ide

我使用 WebStorm 和其他 JetBrains 项目。

我正在寻找一个可以修改新项目设置的命令行工具,这样我就不必手动进行了。

例如,我从不希望拼写检查处于事件状态,我相信这是控制拼写检查的 XML:

<component name="InspectionProjectProfileManager">
  <profile version="1.0">
    <option name="myName" value="Project Default" />
    <inspection_tool class="SpellCheckingInspection" enabled="true" level="TYPO" enabled_by_default="false">
      <option name="processCode" value="true" />
      <option name="processLiterals" value="true" />
      <option name="processComments" value="true" />
    </inspection_tool>
  </profile>
</component>

有谁知道可以执行此操作的 JetBrains 工具,还是我应该自己编写一些东西?

执行此操作的正确方法是每个用户自行修改 JetBrains 产品的默认设置。

https://www.jetbrains.com/help/webstorm/accessing-default-settings.html

但是,我仍然很好奇是否有使用/创建命令行工具来更改每个项目设置的好方法。

最佳答案

如果您了解 XPath,另一种选择是使用 xmlstarlet .具体来说,ed (edit) command .

示例命令行...

xmlstarlet ed -u "//inspection_tool[@class='SpellCheckingInspection']/@enabled" -v "false" some_settings_file.xml

结果...

<component name="InspectionProjectProfileManager">
  <profile version="1.0">
    <option name="myName" value="Project Default"/>
    <inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
      <option name="processCode" value="true"/>
      <option name="processLiterals" value="true"/>
      <option name="processComments" value="true"/>
    </inspection_tool>
  </profile>
</component>

您还可以通过添加 -L(xmlstarlet ed -L ...)就地编辑文件。

关于xml - 用于修改 JetBrains 项目中 .idea 文件夹中 XML 的命令行工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50180616/

相关文章:

android - 尝试从本地主机获取 xml 时在 Android 应用程序中获取 404

JetBrains WebStorm 中的 JavaScript 变量颜色

linux - 通过终端从现有文件夹在 WebStorm IDE 中打开新项目

java - Wowza 流媒体引擎 Eclipse server.xml

c - 使用 C 中的 DTD 验证 Xml 文件

xml - FindBugs/SpotBugs : Filters: DTO or XML Schema

intellij-idea - 如何在 Cursive IDE 中启用彩虹括号?

java - 无法部署我的 Web 应用程序(Spring MVC、Tomcat 服务器、Maven、IntelliJ)

intellij-idea - 升级后IntelliJ IDEA无法启动

refactoring - 限制 Webstorm 中的重构范围