mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-16 23:51:18 +02:00
Updated the Markdown manuals
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
Script: *list-repos.ps1*
|
||||
========================
|
||||
|
||||
This PowerShell script lists details of all Git repositories in a folder.
|
||||
This PowerShell script lists all Git repositories in a folder with details such as latest tag/branch/status/URL.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@ -25,13 +25,13 @@ PS> ./list-repos.ps1 [[-parentDir] <String>] [<CommonParameters>]
|
||||
Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./list-repos C:\MyRepos
|
||||
PS> ./list-repos.ps1 C:\Repos
|
||||
|
||||
|
||||
|
||||
Repository Latest Tag Branch Status Remote URL
|
||||
---------- ---------- ------ ------ ----------
|
||||
📂cmake v3.23.0 main ✔️clean git@github.com:Kitware/CMake ↓0
|
||||
Local Repo Latest Tag Branch Status Remote Repo
|
||||
---------- ---------- ------ ------ -----------
|
||||
📂cmake v3.23.0 main ✔️clean ↓0 git@github.com:Kitware/CMake
|
||||
...
|
||||
|
||||
```
|
||||
@ -49,17 +49,17 @@ Script Content
|
||||
```powershell
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Lists Git repos
|
||||
Lists Git repositories
|
||||
.DESCRIPTION
|
||||
This PowerShell script lists details of all Git repositories in a folder.
|
||||
This PowerShell script lists all Git repositories in a folder with details such as latest tag/branch/status/URL.
|
||||
.PARAMETER parentDir
|
||||
Specifies the path to the parent directory (current working directory by default)
|
||||
.EXAMPLE
|
||||
PS> ./list-repos C:\MyRepos
|
||||
PS> ./list-repos.ps1 C:\Repos
|
||||
|
||||
Repository Latest Tag Branch Status Remote URL
|
||||
---------- ---------- ------ ------ ----------
|
||||
📂cmake v3.23.0 main ✔️clean git@github.com:Kitware/CMake ↓0
|
||||
Local Repo Latest Tag Branch Status Remote Repo
|
||||
---------- ---------- ------ ------ -----------
|
||||
📂cmake v3.23.0 main ✔️clean ↓0 git@github.com:Kitware/CMake
|
||||
...
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
@ -84,8 +84,8 @@ function ListRepos {
|
||||
$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";}
|
||||
elseif ("$status" -like " M *") { $status = "⚠️changed" }
|
||||
New-Object PSObject -property @{'Local Repo'="📂$folderName";'Latest Tag'="$latestTag";'Branch'="$branch";'Status'="$status";'Remote Repo'="↓$numCommits $remoteURL"}
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ try {
|
||||
$null = (git --version)
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
ListRepos | Format-Table -property @{e='Repository';width=19},@{e='Latest Tag';width=18},@{e='Branch';width=20},@{e='Status';width=10},'Remote URL'
|
||||
ListRepos | Format-Table -property @{e='Local Repo';width=19},@{e='Latest Tag';width=16},@{e='Branch';width=19},@{e='Status';width=10},'Remote Repo'
|
||||
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 03/27/2024 17:36:28)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of list-repos.ps1 as of 05/19/2024 10:25:22)*
|
||||
|
Reference in New Issue
Block a user