Skip to content

Commit f560ddc

Browse files
authored
docs: 📝 Update wiki powershell-snippet (#1542)
1 parent cb6bb6b commit f560ddc

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

.github/wiki/Getting-Started.md

+5-9
Original file line numberDiff line numberDiff 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
131134
function 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
139142
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
148144
Check-DirectoryForNewRepository
149145
}
150146

0 commit comments

Comments
 (0)