From f560ddca7d1da08c26e17e2420694a5aecf4669b Mon Sep 17 00:00:00 2001 From: Asher Date: Thu, 6 Mar 2025 16:46:58 +0530 Subject: [PATCH] docs: :memo: Update wiki powershell-snippet (#1542) --- .github/wiki/Getting-Started.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/wiki/Getting-Started.md b/.github/wiki/Getting-Started.md index 6530463c..91c3124b 100644 --- a/.github/wiki/Getting-Started.md +++ b/.github/wiki/Getting-Started.md @@ -126,25 +126,21 @@ An adaptation of the above snippet suited for `Powershell`. Put this script in t ```pwsh # git repository greeter + +# Set the console output encoding to UTF-8, so that special characters are displayed correctly when piping to Write-Host +[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 $global:lastRepository = $null function Check-DirectoryForNewRepository { $currentRepository = git rev-parse --show-toplevel 2>$null if ($currentRepository -and ($currentRepository -ne $global:lastRepository)) { - onefetch + onefetch | Write-Host } $global:lastRepository = $currentRepository } function Set-Location { - param ( - [string]$path - ) - - # Use the default Set-Location to change the directory - Microsoft.PowerShell.Management\Set-Location -Path $path - - # Check if we are in a new Git repository + Microsoft.PowerShell.Management\Set-Location @args Check-DirectoryForNewRepository }