Updated the manuals

This commit is contained in:
Markus Fleschutz
2024-11-08 12:35:11 +01:00
parent 53eb60baa3
commit 54635c32da
636 changed files with 5289 additions and 2027 deletions

View File

@ -1,15 +1,15 @@
Script: *cd-repo.ps1*
========================
This PowerShell script changes the working directory to a local Git repository.
This PowerShell script changes the working directory to the given local Git repository.
Parameters
----------
```powershell
PS> ./cd-repo.ps1 [[-folderName] <String>] [<CommonParameters>]
/home/markus/Repos/PowerShell/scripts/cd-repo.ps1 [[-folderName] <String>] [<CommonParameters>]
-folderName <String>
Specifies the Git repository's folder name
Specifies the folder name of the Git repository
Required? false
Position? 1
@ -26,7 +26,7 @@ Example
-------
```powershell
PS> ./cd-repo.ps1 rust
📂C:\Repos\rust - current branch is: ## main ... origin/main
📂C:\Repos\rust · on branch: ## main ... origin/main
```
@ -43,14 +43,14 @@ Script Content
```powershell
<#
.SYNOPSIS
Sets the working directory to a repository
Sets the working directory to a repo
.DESCRIPTION
This PowerShell script changes the working directory to a local Git repository.
This PowerShell script changes the working directory to the given local Git repository.
.PARAMETER folderName
Specifies the Git repository's folder name
Specifies the folder name of the Git repository
.EXAMPLE
PS> ./cd-repo.ps1 rust
📂C:\Repos\rust - current branch is: ## main ... origin/main
📂C:\Repos\rust · on branch: ## main ... origin/main
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -62,25 +62,26 @@ param([string]$folderName = "")
try {
if ("$folderName" -eq "") { $folderName = Read-Host "Enter the Git repository's folder name" }
if (Test-Path "$HOME/Repos/" -pathType Container) { # try short name
$path = "$HOME/Repos/"
} elseif (Test-Path "$HOME/repos/" -pathType Container) {
$path = "$HOME/repos/"
} elseif (Test-Path "$HOME/Repositories/" -pathType Container) { # try long name
$path = "$HOME/Repositories/"
} elseif (Test-Path "$HOME/source/repos/" -pathType Container) { # try Visual Studio default
$path = "$HOME/source/repos/"
} elseif (Test-Path "/Repos/" -pathType Container) {
if (Test-Path "~/Repos/" -pathType container) { # try short name
$path = "~/Repos/"
} elseif (Test-Path "~/repos/" -pathType container) {
$path = "~/repos/"
} elseif (Test-Path "~/Repositories/" -pathType container) { # try long name
$path = "~/Repositories/"
} elseif (Test-Path "~/source/repos/" -pathType container) { # try Visual Studio default
$path = "~/source/repos/"
} elseif (Test-Path "/Repos/" -pathType container) {
$path = "/Repos/"
} else {
throw "The folder for Git repositories doesn't exist (yet)"
}
$path += $folderName
if (-not(Test-Path "$path" -pathType Container)) { throw "The path to 📂$path doesn't exist (yet)" }
$path += $folderName
if (-not(Test-Path "$path" -pathType container)) { throw "The path to 📂$path doesn't exist (yet)" }
$path = Resolve-Path "$path"
Set-Location "$path"
Write-Host "📂$path - current branch is: " -noNewline
Write-Host "📂$path · on branch: " -noNewline
& git status --short --branch --show-stash
exit 0 # success
} catch {
@ -89,4 +90,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repo.ps1 as of 08/15/2024 09:50:45)*
*(generated by convert-ps2md.ps1 using the comment-based help of cd-repo.ps1 as of 11/08/2024 12:34:45)*