File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 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
126126
127127``` pwsh
128128# 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
129132$global:lastRepository = $null
130133
131134function Check-DirectoryForNewRepository {
132135 $currentRepository = git rev-parse --show-toplevel 2>$null
133136 if ($currentRepository -and ($currentRepository -ne $global:lastRepository)) {
134- onefetch
137+ onefetch | Write-Host
135138 }
136139 $global:lastRepository = $currentRepository
137140}
138141
139142function 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
148144 Check-DirectoryForNewRepository
149145}
150146
You can’t perform that action at this time.
0 commit comments