mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-25 05:26:47 +01:00
Update cd-repos.ps1
This commit is contained in:
parent
88f2492f99
commit
45f96fa3a2
@ -1,11 +1,11 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the working directory to the user's Git repositories folder
|
||||
Sets the working directory to the user's repos folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script changes the working directory to the user's Git repositories folder.
|
||||
.EXAMPLE
|
||||
PS> ./cd-repos
|
||||
📂/home/Markus/Repos
|
||||
📂C:\Users\Markus\Repos
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -15,7 +15,11 @@
|
||||
try {
|
||||
$Path = Resolve-Path "$HOME/Repos"
|
||||
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"
|
||||
"📂$Path"
|
||||
@ -23,4 +27,4 @@ try {
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user