Skip to content

Commit

Permalink
Status output is colorized (kelleyma49#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
kelleyma49 authored Aug 8, 2022
1 parent ccf6298 commit cee4b26
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions PSFzf.Git.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,16 @@ function IsInGitRepo() {
return $?
}

function Get-ColorAlways() {
function Get-ColorAlways($setting=$null) {
if ($RunningInWindowsTerminal -or -not $IsWindowsCheck) {
' --color=always'
if ($null -ne $setting) {
return $setting
} else {
return ' --color=always'
}
}
else {
''
return ''
}
}

Expand Down Expand Up @@ -96,7 +100,8 @@ function Invoke-PsFzfGitFiles() {

$headerStrings = Get-HeaderStrings

git status --short | `
$statusCmd = "git $(Get-ColorAlways '-c color.status=always') status --short"
Invoke-Expression "& $statusCmd" | `
Invoke-Fzf -Multi -Ansi `
-Preview "$previewCmd" -Header $headerStrings[0] -Bind $headerStrings[1] | foreach-object {
$result += $_.Substring('?? '.Length)
Expand Down

0 comments on commit cee4b26

Please sign in to comment.