Updated the manuals

This commit is contained in:
Markus Fleschutz
2024-03-27 17:36:59 +01:00
parent c5b5cb1c6e
commit aed2b7d940
610 changed files with 1754 additions and 1120 deletions

View File

@@ -1,14 +1,14 @@
Script: *list-branches.ps1*
========================
This PowerShell script lists all branches in a Git repository.
This PowerShell script lists branches in a Git repository - either all (default) or by a search pattern.
Parameters
----------
```powershell
PS> ./list-branches.ps1 [[-RepoDir] <String>] [[-SearchPattern] <String>] [<CommonParameters>]
PS> ./list-branches.ps1 [[-pathToRepo] <String>] [[-searchPattern] <String>] [<CommonParameters>]
-RepoDir <String>
-pathToRepo <String>
Specifies the path to the Git repository (current working directory by default)
Required? false
@@ -17,8 +17,8 @@ PS> ./list-branches.ps1 [[-RepoDir] <String>] [[-SearchPattern] <String>] [<Comm
Accept pipeline input? false
Accept wildcard characters? false
-SearchPattern <String>
Specifies the search patter (anything by default)
-searchPattern <String>
Specifies the search pattern ("*", anything by default)
Required? false
Position? 2
@@ -59,11 +59,11 @@ Script Content
.SYNOPSIS
Lists Git branches
.DESCRIPTION
This PowerShell script lists all branches in a Git repository.
.PARAMETER RepoDir
This PowerShell script lists branches in a Git repository - either all (default) or by a search pattern.
.PARAMETER pathToRepo
Specifies the path to the Git repository (current working directory by default)
.PARAMETER SearchPattern
Specifies the search patter (anything by default)
.PARAMETER searchPattern
Specifies the search pattern ("*", anything by default)
.EXAMPLE
PS> ./list-branches.ps1
@@ -76,28 +76,28 @@ Script Content
Author: Markus Fleschutz | License: CC0
#>
param([string]$RepoDir = "$PWD", [string]$SearchPattern = "*")
param([string]$pathToRepo = "$PWD", [string]$searchPattern = "*")
try {
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
if (-not(Test-Path "$pathToRepo" -pathType container)) { throw "Can't access repo folder '$pathToRepo' - maybe a typo or missing folder permissions?" }
$Null = (git --version)
$null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
& git -C "$RepoDir" fetch
& git -C "$pathToRepo" fetch
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
$Branches = $(git -C "$RepoDir" branch --list --remotes --no-color --no-column)
$branches = $(git -C "$pathToRepo" branch --list --remotes --no-color --no-column)
if ($lastExitCode -ne "0") { throw "'git branch --list' failed" }
""
"List of Git Branches"
"--------------------"
foreach($Branch in $Branches) {
if ("$Branch" -match "origin/HEAD") { continue }
$BranchName = $Branch.substring(9)
if ("$BranchName" -notlike "$SearchPattern") { continue }
"$BranchName"
foreach($branch in $branches) {
if ("$branch" -match "origin/HEAD") { continue }
$branchName = $branch.substring(9)
if ("$branchName" -notlike "$searchPattern") { continue }
"$branchName"
}
""
exit 0 # success
@@ -107,4 +107,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of list-branches.ps1 as of 01/25/2024 13:58:38)*
*(generated by convert-ps2md.ps1 using the comment-based help of list-branches.ps1 as of 03/27/2024 17:36:27)*