mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-12 04:58:19 +02:00
Update cd-repos.ps1
This commit is contained in:
parent
88f2492f99
commit
45f96fa3a2
@ -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"
|
||||||
|
Loading…
Reference in New Issue
Block a user