From 870ff867783f4dbd2694e5bf6f6e2f55bd6cc0a6 Mon Sep 17 00:00:00 2001 From: Mateusz Bajorek Date: Wed, 1 Nov 2023 14:35:16 +0100 Subject: [PATCH] feat(git): add .LatestTag template property --- src/segments/git.go | 4 ++++ website/docs/segments/git.mdx | 1 + 2 files changed, 5 insertions(+) diff --git a/src/segments/git.go b/src/segments/git.go index 5080c7e6..d72ea0e8 100644 --- a/src/segments/git.go +++ b/src/segments/git.go @@ -832,3 +832,7 @@ func (g *Git) getSwitchMode(property properties.Property, gitSwitch, mode string } return fmt.Sprintf("%s%s", gitSwitch, mode) } + +func (g *Git) LatestTag() string { + return g.getGitCommandOutput("describe", "--tags", "--abbrev=0") +} diff --git a/website/docs/segments/git.mdx b/website/docs/segments/git.mdx index a20654db..0d108e7b 100644 --- a/website/docs/segments/git.mdx +++ b/website/docs/segments/git.mdx @@ -158,6 +158,7 @@ You can set the following properties to `true` to enable fetching additional inf | `.Rebase` | `boolean` | true when in a rebase | | `.CherryPick` | `boolean` | true when in a cherry pick | | `.Revert` | `boolean` | true when in a revert | +| `.LatestTag` | `string` | the latest tag name | ### Status