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,12 +1,12 @@
Script: *list-repos.ps1*
========================
This PowerShell script lists all Git repositories in a folder with details such as latest tag/branch/status/URL.
This PowerShell script lists all Git repositories under a folder with details such as latest tag, branch, remote URL, and status.
Parameters
----------
```powershell
PS> ./list-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
/home/markus/Repos/PowerShell/scripts/list-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
-parentDir <String>
Specifies the path to the parent directory (current working directory by default)
@@ -25,13 +25,13 @@ PS> ./list-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
Example
-------
```powershell
PS> ./list-repos.ps1 C:\Repos
PS> ./list-repos.ps1 C:\MyRepos
Local Repo Latest Tag Branch Status Remote Repo
---------- ---------- ------ ------ -----------
📂cmake v3.23.0 main clean 0 git@github.com:Kitware/CMake
REPOSITORY LATEST TAG BRANCH REMOTE URL STATUS
---------- ---------- ------ ---------- ------
📂cmake v3.30.2 master https://github.com/Kitware/CMake clean 0
...
```
@@ -51,15 +51,15 @@ Script Content
.SYNOPSIS
Lists Git repositories
.DESCRIPTION
This PowerShell script lists all Git repositories in a folder with details such as latest tag/branch/status/URL.
This PowerShell script lists all Git repositories under a folder with details such as latest tag, branch, remote URL, and status.
.PARAMETER parentDir
Specifies the path to the parent directory (current working directory by default)
.EXAMPLE
PS> ./list-repos.ps1 C:\Repos
PS> ./list-repos.ps1 C:\MyRepos
Local Repo Latest Tag Branch Status Remote Repo
---------- ---------- ------ ------ -----------
📂cmake v3.23.0 main ✔clean ↓0 git@github.com:Kitware/CMake
REPOSITORY LATEST TAG BRANCH REMOTE URL STATUS
---------- ---------- ------ ---------- ------
📂cmake v3.30.2 master https://github.com/Kitware/CMake ✅clean ↓0
...
.LINK
https://github.com/fleschutz/PowerShell
@@ -70,32 +70,32 @@ Script Content
param([string]$parentDir = "$PWD")
function ListRepos {
$folders = (Get-ChildItem "$parentDir" -attributes Directory)
foreach($folder in $folders) {
$folderName = (Get-Item "$folder").Name
$latestTagCommitID = (git -C "$folder" rev-list --tags --max-count=1)
if ($latestTagCommitID -ne "") {
$latestTag = (git -C "$folder" describe --tags $latestTagCommitID)
$dirs = (Get-ChildItem "$parentDir" -attributes Directory)
foreach($dir in $dirs) {
$dirName = (Get-Item "$dir").Name
$latestTagCommitID = (git -C "$dir" rev-list --tags --max-count=1)
if ("$latestTagCommitID" -ne "") {
$latestTag = (git -C "$dir" describe --tags $latestTagCommitID)
} else {
$latestTag = ""
}
$branch = (git -C "$folder" branch --show-current)
$remoteURL = (git -C "$folder" remote get-url origin)
$numCommits = (git -C "$folder" rev-list HEAD...origin/$branch --count)
$status = (git -C "$folder" status --short)
if ("$status" -eq "") { $status = "✔️clean" }
$branch = (git -C "$dir" branch --show-current)
$remoteURL = (git -C "$dir" remote get-url origin)
$numCommits = (git -C "$dir" rev-list HEAD...origin/$branch --count)
$status = (git -C "$dir" status --short)
if ("$status" -eq "") { $status = "clean" }
elseif ("$status" -like " M *") { $status = "⚠changed" }
New-Object PSObject -property @{'Local Repo'="📂$folderName";'Latest Tag'="$latestTag";'Branch'="$branch";'Status'="$status";'Remote Repo'="$numCommits $remoteURL"}
New-Object PSObject -property @{'REPOSITORY'="📂$dirName";'LATEST TAG'="$latestTag";'BRANCH'="$branch";'REMOTE URL'="$remoteURL";'STATUS'="$status $numCommits"}
}
}
try {
if (-not(Test-Path "$parentDir" -pathType container)) { throw "Can't access directory: $parentDir" }
if (-not(Test-Path "$parentDir" -pathType container)) { throw "Can't access parent directory at: $parentDir" }
$null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
ListRepos | Format-Table -property @{e='Local Repo';width=19},@{e='Latest Tag';width=16},@{e='Branch';width=19},@{e='Status';width=10},'Remote Repo'
ListRepos | Format-Table -property @{e='REPOSITORY';width=19},@{e='LATEST TAG';width=16},@{e='BRANCH';width=19},@{e='REMOTE URL';width=47},@{e='STATUS';width=12}
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
@@ -103,4 +103,4 @@ try {
}
```
*(generated by convert-ps2md.ps1 using the comment-based help of list-repos.ps1 as of 08/15/2024 09:50:50)*
*(generated by convert-ps2md.ps1 using the comment-based help of list-repos.ps1 as of 11/08/2024 12:34:51)*