diff options
| -rw-r--r-- | README.md | 11 | ||||
| -rw-r--r-- | sources.go | 15 | ||||
| -rw-r--r-- | yae.go | 12 |
3 files changed, 30 insertions, 8 deletions
@@ -40,9 +40,18 @@ yae add \ zen-browser-bin \ 'https://github.com/zen-browser/desktop/releases/download/{version}/zen.linux-specific.tar.bz2' +# Adds a Yae dependency named `yaak` pinned at tag `2024.10.1` with tag trimming for updates +yae add \ + --type git \ + --unpack=false \ + --version 2024.10.1 \ + --trim-tag-prefix v \ + yaak \ + 'https://github.com/yaakapp/app/releases/download/v{version}/yaak_{version}_amd64.AppImage.tar.gz' + # Updates all dependencies, e.g., updates the hash of `zen-browser-twilight-bin` # and bumps the version of `zen-browser-bin` to `1.0.1-a.8`, handling URI and -# hash recalculations +# hash recalculations, etc. yae update # Only updates `zen-browser-twilight-bin` @@ -9,13 +9,14 @@ import ( type Sources map[string]Source type Source struct { - URI string `json:"url"` - SHA256 string `json:"sha256"` - Unpack bool `json:"unpack"` - Type string `json:"type"` - Version string `json:"version,omitempty"` - URITemplate string `json:"uri_template,omitempty"` - TagPredicate string `json:"tag_predicate,omitempty"` + URI string `json:"url"` + SHA256 string `json:"sha256"` + Unpack bool `json:"unpack"` + Type string `json:"type"` + Version string `json:"version,omitempty"` + URITemplate string `json:"uri_template,omitempty"` + TagPredicate string `json:"tag_predicate,omitempty"` + TrimTagPrefix string `json:"trim_tag_prefix,omitempty"` } func (s *Sources) EnsureLoaded() error { @@ -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 } |