mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-15 23:28:07 +02:00
Updated the manuals
This commit is contained in:
@ -15,6 +15,7 @@ Parameters
|
||||
Position? 1
|
||||
Default value
|
||||
Accept pipeline input? false
|
||||
Aliases
|
||||
Accept wildcard characters? false
|
||||
|
||||
[<CommonParameters>]
|
||||
@ -26,7 +27,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./cd-repo.ps1 rust
|
||||
📂C:\Repos\rust · on branch: ## main ... origin/main
|
||||
📂C:\Repos\rust entered, current branch is: ## main ... origin/main
|
||||
|
||||
```
|
||||
|
||||
@ -50,7 +51,7 @@ Script Content
|
||||
Specifies the folder name of the Git repository
|
||||
.EXAMPLE
|
||||
PS> ./cd-repo.ps1 rust
|
||||
📂C:\Repos\rust · on branch: ## main ... origin/main
|
||||
📂C:\Repos\rust entered, current branch is: ## main ... origin/main
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -60,36 +61,28 @@ Script Content
|
||||
param([string]$folderName = "")
|
||||
|
||||
try {
|
||||
if ("$folderName" -eq "") { $folderName = Read-Host "Enter the Git repository's folder name" }
|
||||
if ("$folderName" -eq "") { $folderName = Read-Host "Please enter the Git repository's folder name" }
|
||||
|
||||
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"
|
||||
}
|
||||
$path += "/" + $folderName
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "The path to 📂$path doesn't exist (yet)" }
|
||||
if (-not(Test-Path "$path" -pathType container)) { throw "The file path '$path' doesn't exist (yet)" }
|
||||
|
||||
$path = Resolve-Path "$path"
|
||||
Set-Location "$path"
|
||||
Write-Host "📂$path · on branch: " -noNewline
|
||||
& git status --short --branch --show-stash
|
||||
Write-Host "📂$path entered, current branch is: " -noNewline
|
||||
& git status --branch --short
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0])"
|
||||
@ -97,4 +90,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:19)*
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:52)*
|
||||
|
Reference in New Issue
Block a user