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

@ -6,10 +6,10 @@ This PowerShell script lists details of all Git repositories in a folder.
Parameters
----------
```powershell
PS> ./list-repos.ps1 [[-ParentDir] <String>] [<CommonParameters>]
PS> ./list-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
-ParentDir <String>
Specifies the path to the parent directory.
-parentDir <String>
Specifies the path to the parent directory (current working directory by default)
Required? false
Position? 1
@ -29,7 +29,7 @@ PS> ./list-repos C:\MyRepos
Local Repo Latest Tag Branch Status Remote URL
Repository Latest Tag Branch Status Remote URL
---------- ---------- ------ ------ ----------
📂cmake v3.23.0 main clean git@github.com:Kitware/CMake 0
...
@ -52,12 +52,12 @@ Script Content
Lists Git repos
.DESCRIPTION
This PowerShell script lists details of all Git repositories in a folder.
.PARAMETER ParentDir
Specifies the path to the parent directory.
.PARAMETER parentDir
Specifies the path to the parent directory (current working directory by default)
.EXAMPLE
PS> ./list-repos C:\MyRepos
Local Repo Latest Tag Branch Status Remote URL
Repository Latest Tag Branch Status Remote URL
---------- ---------- ------ ------ ----------
📂cmake v3.23.0 main ✔clean git@github.com:Kitware/CMake ↓0
...
@ -67,35 +67,35 @@ Script Content
Author: Markus Fleschutz | License: CC0
#>
param([string]$ParentDir = "$PWD")
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)
$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)
} else {
$LatestTag = ""
$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" }
elseif ("$Status" -like " M *") { $Status = "⚠modified" }
New-Object PSObject -property @{'Local Repo'="📂$FolderName";'Latest Tag'="$LatestTag";'Branch'="$Branch";'Status'="$Status";'Remote URL'="$RemoteURL$NumCommits";}
$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" }
elseif ("$status" -like " M *") { $status = "⚠modified" }
New-Object PSObject -property @{'Repository'="📂$folderName";'Latest Tag'="$latestTag";'Branch'="$branch";'Status'="$status";'Remote URL'="$remoteURL$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 directory: $parentDir" }
$Null = (git --version)
$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=18},@{e='Branch';width=20},@{e='Status';width=10},'Remote URL'
ListRepos | Format-Table -property @{e='Repository';width=19},@{e='Latest Tag';width=18},@{e='Branch';width=20},@{e='Status';width=10},'Remote URL'
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 01/25/2024 13:58:39)*
*(generated by convert-ps2md.ps1 using the comment-based help of list-repos.ps1 as of 03/27/2024 17:36:28)*