File tree 1 file changed +5
-9
lines changed
1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -126,25 +126,21 @@ An adaptation of the above snippet suited for `Powershell`. Put this script in t
126
126
127
127
``` pwsh
128
128
# git repository greeter
129
+
130
+ # Set the console output encoding to UTF-8, so that special characters are displayed correctly when piping to Write-Host
131
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
129
132
$global:lastRepository = $null
130
133
131
134
function Check-DirectoryForNewRepository {
132
135
$currentRepository = git rev-parse --show-toplevel 2>$null
133
136
if ($currentRepository -and ($currentRepository -ne $global:lastRepository)) {
134
- onefetch
137
+ onefetch | Write-Host
135
138
}
136
139
$global:lastRepository = $currentRepository
137
140
}
138
141
139
142
function Set-Location {
140
- param (
141
- [string]$path
142
- )
143
-
144
- # Use the default Set-Location to change the directory
145
- Microsoft.PowerShell.Management\Set-Location -Path $path
146
-
147
- # Check if we are in a new Git repository
143
+ Microsoft.PowerShell.Management\Set-Location @args
148
144
Check-DirectoryForNewRepository
149
145
}
150
146
You can’t perform that action at this time.
0 commit comments