diff --git a/Types/git.status/Git.Status.format.ps1 b/Types/git.status/Git.Status.format.ps1 index 12706f7d..119747b6 100644 --- a/Types/git.status/Git.Status.format.ps1 +++ b/Types/git.status/Git.Status.format.ps1 @@ -1,10 +1,10 @@ Write-FormatView -TypeName Git.Status -Action { - Write-FormatViewExpression -Text "On Branch: " + Write-FormatViewExpression -Text "On branch: " Write-FormatViewExpression -ScriptBlock { $_.BranchName } -if { $_.BranchName -notin 'main', 'master' } -ForegroundColor Verbose Write-FormatViewExpression -ScriptBlock { $_.BranchName } -if { $_.BranchName -in 'main', 'master' } -ForegroundColor Warning Write-FormatViewExpression -Newline Write-FormatViewExpression -If { $_.Status -notlike 'Nothing*' } -ScriptBlock { $_.Status + [Environment]::NewLine } - Write-formatviewExpression -If { $_.Staged } -ScriptBlock { + Write-formatviewExpression -If { $_.Staged } -ScriptBlock { "Changes Staged For Commit: (use git commit -m to commit)" + [Environment]::NewLine } @@ -12,9 +12,9 @@ Write-FormatView -TypeName Git.Status -Action { (@(foreach ($line in $($_.Staged | Select-Object ChangeType, Path | Out-String -Width ($host.UI.RawUI.BufferSize.Width - 8)) -split '(?>\r\n|\n)') { (" " * 4) + $line }) -join [Environment]::NewLine) + [Environment]::NewLine - } + } -ForegroundColor Green - Write-FormatViewExpression -If { $_.Unstaged } -ScriptBlock { + Write-FormatViewExpression -If { $_.Unstaged } -ScriptBlock { "Changes Not Staged For Commit: (use git add to add, git restore to discard changes)" + [Environment]::NewLine } @@ -23,7 +23,7 @@ Write-FormatView -TypeName Git.Status -Action { (@(foreach ($line in $($_.Unstaged | Select-Object ChangeType, Path | Out-String -Width ($host.UI.RawUI.BufferSize.Width - 8)) -split '(?>\r\n|\n)') { (" " * 4) + $line }) -join [Environment]::NewLine) + [Environment]::NewLine - } + } -ForegroundColor Red Write-FormatViewExpression -If { $_.Untracked } -ScriptBlock { "Untracked Files: @@ -34,11 +34,12 @@ Write-FormatView -TypeName Git.Status -Action { @(foreach ($line in $($_.Untracked | Out-String -Width ($host.UI.RawUI.BufferSize.Width - 8)) -split '(?>\r\n|\n)') { (" " * 4) + $line }) -join [Environment]::NewLine - } + } -ForegroundColor Red - Write-FormatViewExpression -if { - $gitStatus = $_ - (-not $gitStatus.Untracked) -and (-not $gitStatus.Unstaged) -and (-not $gitStatus.Staged) - } -Text "Nothing to commit, working tree clean" - -} -GroupByProperty GitRoot + Write-FormatViewExpression -ScriptBlock { + if(($_.Untracked.Count + $_.Unstaged.Count + $_.Staged.Count) -eq 0) + { + "Nothing to commit, working tree clean" + } + } +} diff --git a/ugit.format.ps1xml b/ugit.format.ps1xml index e0043e5a..97fc61df 100644 --- a/ugit.format.ps1xml +++ b/ugit.format.ps1xml @@ -2826,14 +2826,11 @@ $BackgroundColor Git.Status - - GitRoot - - On Branch: + On branch: $_.BranchName -notin 'main', 'master' @@ -2908,11 +2905,17 @@ $BackgroundColor $_.Staged - + "Changes Staged For Commit: (use git commit -m to commit)" + [Environment]::NewLine + + + $_.Staged + + @(& ${ugit_Format-RichText} -ForegroundColor 'Green' -NoClear) -join '' + $_.Staged @@ -2923,15 +2926,27 @@ $BackgroundColor }) -join [Environment]::NewLine) + [Environment]::NewLine + + + $_.Staged + + @(& ${ugit_Format-RichText} -ForegroundColor 'Green' ) -join '' + $_.Unstaged - + "Changes Not Staged For Commit: (use git add <file> to add, git restore <file> to discard changes)" + [Environment]::NewLine + + + $_.Unstaged + + @(& ${ugit_Format-RichText} -ForegroundColor 'Red' -NoClear) -join '' + $_.Unstaged @@ -2942,6 +2957,12 @@ $BackgroundColor }) -join [Environment]::NewLine) + [Environment]::NewLine + + + $_.Unstaged + + @(& ${ugit_Format-RichText} -ForegroundColor 'Red' ) -join '' + $_.Untracked @@ -2951,6 +2972,12 @@ $BackgroundColor (use git add <file> to include in commit)" + [Environment]::NewLine + + + $_.Untracked + + @(& ${ugit_Format-RichText} -ForegroundColor 'Red' -NoClear) -join '' + $_.Untracked @@ -2961,7 +2988,20 @@ $BackgroundColor }) -join [Environment]::NewLine - Nothing to commit, working tree clean + + + $_.Untracked + + @(& ${ugit_Format-RichText} -ForegroundColor 'Red' ) -join '' + + + + if(($_.Untracked.Count + $_.Unstaged.Count + $_.Staged.Count) -eq 0) + { + "Nothing to commit, working tree clean" + } + +