mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-29 10:09:37 +01:00
Update list-tags.ps1
This commit is contained in:
parent
c6a67c9860
commit
2551930aed
@ -1,8 +1,8 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Lists all tags in a Git repository
|
Lists all tags in a repository
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script lists all tags in a Git repository.
|
This PowerShell script fetches and lists all tags in a Git repository.
|
||||||
.PARAMETER RepoDir
|
.PARAMETER RepoDir
|
||||||
Specifies the path to the Git repository (current working directory by default)
|
Specifies the path to the Git repository (current working directory by default)
|
||||||
.PARAMETER SearchPattern
|
.PARAMETER SearchPattern
|
||||||
@ -27,20 +27,18 @@ try {
|
|||||||
$Null = (git --version)
|
$Null = (git --version)
|
||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||||
|
|
||||||
Write-Progress "⏳ (2/3) Checking folder... "
|
Write-Progress "⏳ (2/3) Checking local repository... "
|
||||||
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
|
|
||||||
Write-Progress "⏳ (3/3) Fetching latest tags..."
|
Write-Progress "⏳ (3/3) Fetching latest tags..."
|
||||||
& git -C "$RepoDir" fetch --all --tags --quiet
|
& git -C "$RepoDir" fetch --tags
|
||||||
if ($lastExitCode -ne "0") { throw "'git fetch --all --tags' failed" }
|
if ($lastExitCode -ne "0") { throw "'git fetch --tags' failed" }
|
||||||
|
Write-Progress -completed "."
|
||||||
Write-Progress -completed "Fetched"
|
|
||||||
""
|
""
|
||||||
"Tag Description"
|
"Tag Description"
|
||||||
"--- -----------"
|
"--- -----------"
|
||||||
& git -C "$RepoDir" tag --list "$SearchPattern" -n
|
& git -C "$RepoDir" tag --list "$SearchPattern" -n
|
||||||
if ($lastExitCode -ne "0") { throw "'git tag --list' failed" }
|
if ($lastExitCode -ne "0") { throw "'git tag --list' failed" }
|
||||||
|
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user