diff options
| author | Fuwn <[email protected]> | 2024-10-11 05:56:07 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-10-11 06:01:49 -0700 |
| commit | e4182d17bfe5437375b0fa7a3e1e2a5669311097 (patch) | |
| tree | 9586b869815aff09e2b429ad179fa76143995094 /yae.go | |
| parent | 7d42732046acbe073449bcf8bd98fa3c1bbb0ebf (diff) | |
| download | yae-e4182d17bfe5437375b0fa7a3e1e2a5669311097.tar.xz yae-e4182d17bfe5437375b0fa7a3e1e2a5669311097.zip | |
feat(yae): tag predicate prefix trimming
Diffstat (limited to 'yae.go')
| -rw-r--r-- | yae.go | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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 } |