Improve list-tags.ps1

This commit is contained in:
Markus Fleschutz 2021-03-19 11:36:46 +01:00
parent d572bf467c
commit 5603555d48

View File

@ -1,12 +1,12 @@
#!/bin/powershell #!/bin/powershell
<# <#
.SYNTAX ./list-tags.ps1 [<repo-dir>] .SYNTAX ./list-tags.ps1 [<repo-dir>] [<pattern>]
.DESCRIPTION lists all tags in the current/given Git repository .DESCRIPTION lists all tags in the current/given Git repository
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0 .NOTES Author: Markus Fleschutz / License: CC0
#> #>
param($RepoDir = "$PWD") param($RepoDir = "$PWD", $Pattern="*")
try { try {
write-output "Fetching updates for Git repository $RepoDir ..." write-output "Fetching updates for Git repository $RepoDir ..."
@ -24,8 +24,8 @@ try {
write-output "List of Git Tags" write-output "List of Git Tags"
write-output "----------------" write-output "----------------"
& git tag & git tag --list "$Pattern"
if ($lastExitCode -ne "0") { throw "'git tag' failed" } if ($lastExitCode -ne "0") { throw "'git tag --list' failed" }
write-output "" write-output ""
exit 0 exit 0