mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-19 11:11:29 +01:00
Update cd-repos.ps1
This commit is contained in:
parent
7de3ba458b
commit
bfde55932f
@ -5,7 +5,7 @@
|
|||||||
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
|
||||||
📂C:\Users\Markus\source\repos
|
📂C:\Users\Markus\Repos
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -13,12 +13,14 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($IsLinux) {
|
if (Test-Path "$HOME/Repos" -pathType Container) {
|
||||||
$Path = Resolve-Path "$HOME/Repos"
|
$Path = Resolve-Path "$HOME/Repos"
|
||||||
} else {
|
} elseif (Test-Path "$HOME/Repositories" -pathType Container) {
|
||||||
|
$Path = Resolve-Path "$HOME/Repositories"
|
||||||
|
} elseif (Test-Path "$HOME/source/repos" -pathType Container) {
|
||||||
$Path = Resolve-Path "$HOME/source/repos"
|
$Path = Resolve-Path "$HOME/source/repos"
|
||||||
}
|
} else {
|
||||||
if (-not(Test-Path "$Path" -pathType container)) {
|
$Path = "$HOME/Repos"
|
||||||
throw "Folder for Git repositories at 📂$Path doesn't exist (yet)"
|
throw "Folder for Git repositories at 📂$Path doesn't exist (yet)"
|
||||||
}
|
}
|
||||||
Set-Location "$Path"
|
Set-Location "$Path"
|
||||||
|
Loading…
Reference in New Issue
Block a user