Update list-tags.ps1

This commit is contained in:
Markus Fleschutz 2022-11-02 21:43:10 +01:00
parent d0fe73ce11
commit 52eb6034bc

View File

@ -2,9 +2,9 @@
.SYNOPSIS
Lists all tags in a Git repository
.DESCRIPTION
This PowerShell script lists all tags in the given Git repository.
This PowerShell script lists all tags in a Git repository.
.PARAMETER RepoDir
Specifies the path to the Git repository
Specifies the path to the Git repository (current working directory by default)
.PARAMETER SearchPattern
Specifies the search pattern (anything by default)
.EXAMPLE
@ -23,16 +23,18 @@
param([string]$RepoDir = "$PWD", [string]$SearchPattern="*")
try {
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
Write-Progress "⏳ (1/3) Searching for Git executable... "
$Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
write-progress "🢃 Fetching latest tags..."
Write-Progress "⏳ (2/3) Checking folder... "
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
Write-Progress "⏳ (3/3) Fetching latest tags..."
& git -C "$RepoDir" fetch --all --tags --quiet
if ($lastExitCode -ne "0") { throw "'git fetch --all --tags' failed" }
write-progress -completed "Fetched"
Write-Progress -completed "Fetched"
""
"Tag Description"
"--- -----------"
@ -43,4 +45,4 @@ try {
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}
}