mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-28 07:38:38 +01:00
Add list-tags.ps1
This commit is contained in:
parent
54d9084c0e
commit
e29e0c1c14
@ -73,6 +73,7 @@ list-profiles.ps1, lists your PowerShell profiles
|
||||
list-random-passwords.ps1, prints a list of random passwords
|
||||
list-random-pins.ps1, prints a list of random PIN's
|
||||
list-scripts.ps1, lists all PowerShell scripts in this repository
|
||||
list-tags.ps1, lists all tags in the current/given Git repository
|
||||
list-timezones.ps1, lists all time zones available
|
||||
list-user-groups.ps1, lists the user groups on the local computer
|
||||
locate-city.ps1, prints the geographic location of the given city
|
||||
|
|
@ -109,6 +109,7 @@ Collection of PowerShell Scripts
|
||||
* [fetch-repos.ps1](Scripts/fetch-repos.ps1) - fetches updates for all Git repositories under the current/given directory (including submodules)
|
||||
* [list-branches.ps1](Scripts/list-branches.ps1) - lists all branches in the current/given Git repository
|
||||
* [list-commits.ps1](Scripts/list-commits.ps1) - lists all commits in the current/given Git repository
|
||||
* [list-tags.ps1](Scripts/list-tags.ps1) - lists all tags in the current/given Git repository
|
||||
* [switch-branch.ps1](Scripts/switch-branch.ps1) - switches the branch in the current/given Git repository (including submodules)
|
||||
* [update-repos.ps1](Scripts/update-repos.ps1) - updates all Git repositories under the current/given directory (including submodules)
|
||||
|
||||
|
35
Scripts/list-tags.ps1
Executable file
35
Scripts/list-tags.ps1
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./list-tags.ps1 [<repo-dir>]
|
||||
.DESCRIPTION lists all tags in the current/given Git repository
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($RepoDir = "$PWD")
|
||||
|
||||
try {
|
||||
write-output "Fetching updates for Git repository $RepoDir ..."
|
||||
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
& git --version
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
& git fetch --all --recurse-submodules
|
||||
if ($lastExitCode -ne "0") { throw "'git fetch --all --recurse-submodules' failed" }
|
||||
|
||||
write-output ""
|
||||
write-output "List of Git Tags"
|
||||
write-output "----------------"
|
||||
|
||||
& git tag
|
||||
if ($lastExitCode -ne "0") { throw "'git tag' failed" }
|
||||
|
||||
write-output ""
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user