ファイルを書き替えたのにgit commitしてなくてアッー!
ってならないように。
function git_status {
git status 2> $null | ForEach-Object {
if ( $_ -eq "# Changes not staged for commit:" ) {
Write-Host "Please run 'git commit'" -ForegroundColor "Red"
}
}
}
プロファイルスクリプトのprompt
ファンクション内でgit_status
を呼び出せばOk。
もう少しマイルドに警告してほしい場合は下記の様にしてもいいかも。
ウィンドウタイトルにアスタリスクを付けるだけの警告です。
function git_status {
git status 2> $null | ForEach-Object {
if ( $_ -eq "# Changes not staged for commit:" ) {
Write-Output "* "
}
}
}
prompt
ファンクション内で
$gitstatus = git_status
$windowtitle = (Get-Host).UI.RawUI.WindowTitle
(Get-Host).UI.RawUI.WindowTitle = $gitstatus + $windowtitle
通常のアプリケーションで内容を変更したときなんかと同じ風な警告ですね。