0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

JetBrains IDE を diff ビューアーとして使う

Posted at

PhpStorm などの JetBrains IDE ではコマンドライン インターフェイスを使うことができます。そしてコマンドラインから diff ビューアーを使うことができます。

公式ヘルプ

これは便利だ、と思って使ってみたところうまく動作しませんでした。
Mac の場合、利用するためには、いくつかの注意が必要です。

コマンドラインインターフェイス で説明されている設定をすることが必要です。手作業でスクリプトを作成した場合は問題ありませんが、Toolbox アプリで生成したシェルスクリプトを使うと期待通りに動作しません。

The file diff does not exist.

みたいなことを言われます。
Toolbox アプリで生成したスクリプトを確認してみます。

$ which phpstorm
/usr/local/bin/phpstorm

$ cat /usr/local/bin/phpstorm
# !/bin/sh
# Generated by JetBrains Toolbox 1.16.6319 at Fri Apr 10 06:30:46 2020

open -a "(中略)/PhpStorm.app/Contents/MacOS/phpstorm" "$@"

このスクリプトのオプションをヘルプ記載のものと合わせます。

open -na "(中略)/PhpStorm.app/Contents/MacOS/phpstorm" --args "$@"

以上で、実行できるようになりました。でも単純にヘルプの前半に記載しているスクリプトを書くほうが楽ですね。

# !/bin/sh

open -na "PhpStorm.app" --args "$@"

もう一点、注意点があります。ファイル名は相対パスで指定するとちゃんと開いてくれません。

phpstorm diff ./test.php ./test2.php

では、起動してすぐに終了します。

phpstorm diff ~/Documents/test.php ~/Documents/test2.php

のように絶対パスで指定します。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?