mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-29 17:18:38 +01:00
Updated list-repos.ps1
This commit is contained in:
parent
69b8b3ee4e
commit
81a8082017
@ -2,7 +2,7 @@
|
||||
.SYNOPSIS
|
||||
Lists Git repositories
|
||||
.DESCRIPTION
|
||||
This PowerShell script lists all Git repositories in a folder with some details.
|
||||
This PowerShell script lists all Git repositories in a folder with details such as tag/branch/status/URL.
|
||||
.PARAMETER parentDir
|
||||
Specifies the path to the parent directory (current working directory by default)
|
||||
.EXAMPLE
|
||||
@ -36,7 +36,7 @@ function ListRepos {
|
||||
$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 Repo'="$remoteURL ↓$numCommits";}
|
||||
New-Object PSObject -property @{'Local Repo'="📂$folderName";'Latest Tag'="$latestTag";'Branch'="$branch";'Remote Repo'="$remoteURL";'Status'="$status ↓$numCommits"}
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +46,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='Local Repo';width=19},@{e='Latest Tag';width=18},@{e='Branch';width=20},@{e='Status';width=10},'Remote Repo'
|
||||
ListRepos | Format-Table -property @{e='Local Repo';width=19},@{e='Latest Tag';width=18},@{e='Branch';width=15},'Remote Repo',@{e='Status';width=14}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user