From 89e6466df85bb45c13ba1ae467dfbb11c28260ee Mon Sep 17 00:00:00 2001 From: Fuwn Date: Fri, 11 Oct 2024 13:08:27 +0000 Subject: feat(yae): prevent updates with pinning --- yae.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'yae.go') diff --git a/yae.go b/yae.go index b69c7e3..621beb9 100644 --- a/yae.go +++ b/yae.go @@ -97,6 +97,10 @@ func main() { Name: "trim-tag-prefix", Usage: "A prefix to trim from remote git tags", }, + &cli.BoolFlag{ + Name: "pin", + Usage: "Prevent the source from being updated", + }, }, Action: func(c *cli.Context) error { if c.Args().Len() != 2 { @@ -132,6 +136,10 @@ func main() { source.TrimTagPrefix = c.String("trim-tag-prefix") } + if c.Bool("pin") { + source.Pinned = true + } + if sha256, err := fetchSHA256(source.URI, c.Bool("unpack"), !c.Bool("silent")); err != nil { return err } else { @@ -298,6 +306,14 @@ func updateSource(sources *Sources, name string, source Source, show bool) (bool return updated, fmt.Errorf("source does not exist") } + if source.Pinned { + if show { + fmt.Println("skipped update for", name, "because it is pinned") + } + + return updated, nil + } + if source.Type == "git" { tag, err := fetchLatestGitTag(source, show) -- cgit v1.2.3