Browse Source

docs: 📝 Update wiki powershell-snippet (#1542)

pull/1548/head
Asher 10 months ago committed by GitHub
parent
commit
f560ddca7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 14
      .github/wiki/Getting-Started.md

14
.github/wiki/Getting-Started.md

@ -126,25 +126,21 @@ An adaptation of the above snippet suited for `Powershell`. Put this script in t @@ -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
}

Loading…
Cancel
Save