tigでカスタムコマンドを追加する
tig が便利です。
tig はデフォルトでは以下gitに関するコマンドのショートカットが提供されています(ヘルプより)。
'C' `git commit`
'C' `git checkout %(branch)`
'R' `git rebase -i %(commit)`
'C' `git cherry-pick %(commit)`
'G' `git gc`
cherry-pickとか使えてかなり便利だったりするのですが、 色々使っているとこれだけだと物足りなくなってきてカスタマイズできるか調べてみました。
tigrc を読んでみると、 ~/.tigrc に任意の設定を記述する事で、カスタマイズ出来るようです。
自分は git rebase -i xxxx をしたいので以下のように設定を行いました。
bind main R !?git rebase -i %(commit)
簡単に説明しておきます...。
- bind
- 任意のコマンドをバインドする事を宣言します。
- main
- メインウィンドウに対してカスタムコマンドを有効とします
- R
- ショートカットキーです。ここの設定だと shift+r で発動します。
- !
- 外部コマンドを呼び出す場合
- ?
- 実行時にYES/NOで確認させたい場合に設定します。 さすがにrebase -i勝手に発動されると困るので、この設定をつけています。
- git rebase -i
- コマンドそのまま
- $(commit)
- tig上で選択している要素に対するCommitHashを表現する変数です。
上記の例では ? を利用して確認を表示する用にしていますが、 同等のフラグとして以下が定義可能です。
コマンド | 概要 |
---|---|
@ | バックグラウンドで実行し、外部出力を行いません。 |
? | コマンドを実行する前にユーザに対して、確認プロンプトを表示します。 |
< | コマンド実行後tigを終了します。 |
利用できる変数は以下の通りです
変数 | 概要 |
---|---|
%(head) | The currently viewed head ID. Defaults to HEAD |
%(commit) | The currently selected commit ID. |
%(blob) | The currently selected blob ID. |
%(branch) | The currently selected branch name. |
%(directory) | The current directory path in the tree view; empty for the root directory. |
%(file) | The currently selected file. |
%(ref) | The reference given to blame or HEAD if undefined. |
%(revargs) | The revision arguments passed on the command line. |
%(fileargs) | The file arguments passed on the command line. |
%(diffargs) | The diff options passed on the command line. |
%(prompt) | Prompt for the argument value. |
以上です。
CocoaPodsのpodspecにUIKitを設定したらfile not foundが発生した
Kal というライブラリがCocoaPods上に登録されていなかったので、podspecを作成していて pod spec lint とかやってみたら
- ERROR | [OS X] XCODEBUILD > Kal/src/KalMonthView.h:6:9: fatal error: ‘UIKit/UIKit.h’ file not found
で怒られました。
s.framework = 'UIKit'
をやっているんだけどなーと思ってCocoaPodsのissueを探してみると、 XCODEBUILD fatal error UIKit/UIKit.h file not found を発見。
ah got it, i have to set the platform explicit to iOS
ということだったので、
s.platform = :ios, '5.0'
を設定した問題なく実行されました。
以上です。