mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-26 14:26:10 +01:00
Add list-latest-tag.ps1
This commit is contained in:
parent
cfaa7b48da
commit
478d62aa89
@ -94,6 +94,7 @@ list-fritzbox-devices.ps1, lists FRITZ!Box's known devices
|
||||
list-hidden-files.ps1, lists hidden files within the given directory tree
|
||||
list-installed-apps.ps1, lists the installed Windows Store apps
|
||||
list-installed-software.ps1, lists the installed software (except Windows Store apps)
|
||||
list-latest-tag.ps1, lists the latest tag on the current branch in a Git repository
|
||||
list-logbook.ps1, lists the content of the logbook
|
||||
list-unused-files.ps1, lists unused files in a directory tree
|
||||
list-cmdlets.ps1, lists the PowerShell cmdlets
|
||||
|
|
@ -146,6 +146,7 @@ Mega 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-latest-tag.ps1](Scripts/list-latest-tag.ps1) - lists the latest tag on the current branch in a Git repository
|
||||
* [list-tags.ps1](Scripts/list-tags.ps1) - lists all tags in the current/given Git repository
|
||||
* [pull-repo.ps1](Scripts/pull-repo.ps1) - pulls updates for the current/given Git repository (including submodules)
|
||||
* [pull-repos.ps1](Scripts/pull-repos.ps1) - pulls updates for all Git repositories under the current/given directory (including submodules)
|
||||
|
28
Scripts/list-latest-tag.ps1
Executable file
28
Scripts/list-latest-tag.ps1
Executable file
@ -0,0 +1,28 @@
|
||||
<#
|
||||
.SYNTAX list-latest-tag.ps1 [<repo-dir>]
|
||||
.DESCRIPTION lists the latest tag on the current branch in a Git repository
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($RepoDir = "$PWD")
|
||||
|
||||
try {
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
$RepoDirName = (get-item "$RepoDir").Name
|
||||
"⏳ Fetching updates for Git repository 📂$RepoDirName ..."
|
||||
|
||||
$Null = (git --version)
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
& git fetch --all --recurse-submodules --jobs=4
|
||||
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
|
||||
|
||||
& git describe --tags --abbrev=0
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user