aboutsummaryrefslogtreecommitdiff
path: root/yae.go
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-10-11 05:56:07 -0700
committerFuwn <[email protected]>2024-10-11 06:01:49 -0700
commite4182d17bfe5437375b0fa7a3e1e2a5669311097 (patch)
tree9586b869815aff09e2b429ad179fa76143995094 /yae.go
parent7d42732046acbe073449bcf8bd98fa3c1bbb0ebf (diff)
downloadyae-e4182d17bfe5437375b0fa7a3e1e2a5669311097.tar.xz
yae-e4182d17bfe5437375b0fa7a3e1e2a5669311097.zip
feat(yae): tag predicate prefix trimming
Diffstat (limited to 'yae.go')
-rw-r--r--yae.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/yae.go b/yae.go
index 9a2e73d..b69c7e3 100644
--- a/yae.go
+++ b/yae.go
@@ -93,6 +93,10 @@ func main() {
Name: "silent",
Usage: "Silence output",
},
+ &cli.StringFlag{
+ Name: "trim-tag-prefix",
+ Usage: "A prefix to trim from remote git tags",
+ },
},
Action: func(c *cli.Context) error {
if c.Args().Len() != 2 {
@@ -124,6 +128,10 @@ func main() {
source.TagPredicate = c.String("tag-predicate")
}
+ if c.String("trim-tag-prefix") != "" {
+ source.TrimTagPrefix = c.String("trim-tag-prefix")
+ }
+
if sha256, err := fetchSHA256(source.URI, c.Bool("unpack"), !c.Bool("silent")); err != nil {
return err
} else {
@@ -273,6 +281,10 @@ func fetchLatestGitTag(source Source, show bool) (string, error) {
}
}
+ if source.TrimTagPrefix != "" {
+ latest = strings.TrimPrefix(latest, source.TrimTagPrefix)
+ }
+
return latest, nil
}