From f1ba19a6adee0acc64b21fe6eb88625d9a588efd Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Wed, 19 Feb 2025 14:28:03 +0100 Subject: [PATCH] Updated cd-repos.ps1 --- scripts/cd-repos.ps1 | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/scripts/cd-repos.ps1 b/scripts/cd-repos.ps1 index bd00cd30..5430557b 100755 --- a/scripts/cd-repos.ps1 +++ b/scripts/cd-repos.ps1 @@ -2,9 +2,7 @@ .SYNOPSIS Sets the working directory to the Git repos folder .DESCRIPTION - This PowerShell script changes the working directory to the Git repositories folder. -.PARAMETER subpath - Specifies an additional relative subpath (optional) + This PowerShell script changes the working directory to the folder for Git repositories. .EXAMPLE PS> ./cd-repos.ps1 📂C:\Repos @@ -15,26 +13,18 @@ #> try { - if (Test-Path "~/Repos" -pathType Container) { # try short name in home dir - $path = "~/Repos" - } elseif (Test-Path "~/repos" -pathType Container) { - $path = "~/repos" - } elseif (Test-Path "~/Repositories" -pathType Container) { # try long name - $path = "~/Repositories" - } elseif (Test-Path "~/repositories" -pathType Container) { - $path = "~/repositories" - } elseif (Test-Path "/Repos" -pathType Container) { # try short name in root dir - $path = "/Repos" - } elseif (Test-Path "/repos" -pathType Container) { - $path = "/repos" - } elseif (Test-Path "/Repositories" -pathType Container) { # try long name - $path = "/Repositories" - } elseif (Test-Path "/repositories" -pathType Container) { - $path = "/repositories" - } elseif (Test-Path "~/source/repos" -pathType Container) { # try Visual Studio default - $path = "~/source/repos" + if (Test-Path "~/Repos" -pathType container) { $path = "~/Repos" + } elseif (Test-Path "~/repos" -pathType container) { $path = "~/repos" + } elseif (Test-Path "~/Repositories" -pathType container) { $path = "~/Repositories" + } elseif (Test-Path "~/repositories" -pathType container) { $path = "~/repositories" + } elseif (Test-Path "/Repos" -pathType container) { $path = "/Repos" + } elseif (Test-Path "/repos" -pathType container) { $path = "/repos" + } elseif (Test-Path "/Repositories" -pathType container) { $path = "/Repositories" + } elseif (Test-Path "/repositories" -pathType container) { $path = "/repositories" + } elseif (Test-Path "~/source/repos" -pathType container) { $path = "~/source/repos" # Visual Studio default + } elseif (Test-Path "D:/Repos" -pathType container) { $path = "D:/Repos" # second HDD } else { - throw "No Git repositories folder in your home directory or in the root folder yet" + throw "No folder for Git repositories yet (in home or root directory)" } $path = Resolve-Path $path Set-Location "$path"