aboutsummaryrefslogtreecommitdiff
path: root/yae.go
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-10-11 06:08:27 -0700
committerFuwn <[email protected]>2024-10-11 06:08:27 -0700
commitb665bfadc1ace0acae27942af7f69438fa32b8e3 (patch)
treed266cb65aa4181c5658ac9ecccd74a37583cce25 /yae.go
parente4182d17bfe5437375b0fa7a3e1e2a5669311097 (diff)
downloadyae-b665bfadc1ace0acae27942af7f69438fa32b8e3.tar.xz
yae-b665bfadc1ace0acae27942af7f69438fa32b8e3.zip
feat(yae): prevent updates with pinning
Diffstat (limited to 'yae.go')
-rw-r--r--yae.go16
1 files changed, 16 insertions, 0 deletions
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)