Update cd-repos.ps1

This commit is contained in:
Markus Fleschutz 2022-10-24 12:24:35 +02:00
parent 88f2492f99
commit 45f96fa3a2

View File

@ -1,11 +1,11 @@
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working directory to the user's Git repositories folder Sets the working directory to the user's repos folder
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the user's Git repositories folder. This PowerShell script changes the working directory to the user's Git repositories folder.
.EXAMPLE .EXAMPLE
PS> ./cd-repos PS> ./cd-repos
📂/home/Markus/Repos 📂C:\Users\Markus\Repos
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -15,7 +15,11 @@
try { try {
$Path = Resolve-Path "$HOME/Repos" $Path = Resolve-Path "$HOME/Repos"
if (-not(Test-Path "$Path" -pathType container)) { if (-not(Test-Path "$Path" -pathType container)) {
throw "Git repositories folder at 📂$Path doesn't exist (yet)" $Path = Resolve-Path "$HOME/source/repos"
if (-not(Test-Path "$Path" -pathType container)) {
$Path = Resolve-Path "$HOME/Repos"
throw "Folder for Git repositories at 📂$Path doesn't exist (yet)"
}
} }
Set-Location "$Path" Set-Location "$Path"
"📂$Path" "📂$Path"