diff options
| author | Fuwn <[email protected]> | 2024-10-11 14:24:09 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-10-11 14:24:09 -0700 |
| commit | 1dd506956b77cf58ed7f46a6e4aa30ec11b78c20 (patch) | |
| tree | 06f9641b3a88c126770db4dad91deb3e3246b4fc /yae.go | |
| parent | fa7a25f63dec35648abf8b6e2953edc7a7fe1dbc (diff) | |
| download | yae-1dd506956b77cf58ed7f46a6e4aa30ec11b78c20.tar.xz yae-1dd506956b77cf58ed7f46a6e4aa30ec11b78c20.zip | |
feat(yae): force pinned updates flag
Diffstat (limited to 'yae.go')
| -rw-r--r-- | yae.go | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -187,17 +187,22 @@ func main() { }, &cli.BoolFlag{ Name: "force-hashed", - Usage: "Force updates to non-pinned sources that have an unchanged version (recalculate hash)", + Usage: "Force updates for non-pinned sources that have an unchanged version (recalculate hash)", + }, + &cli.BoolFlag{ + Name: "force-pinned", + Usage: "Force updates for all sources, including pinned sources (can be used with --force-hashed)", }, }, Action: func(c *cli.Context) error { showAll := !c.Bool("show-updated-only") && !c.Bool("show-updated-only-formatted") updates := []string{} force := c.Bool("force-hashed") + forcePinned := c.Bool("force-pinned") if c.Args().Len() == 0 { for name, value := range sources { - if updated, err := updateSource(&sources, name, value, showAll, force); err != nil { + if updated, err := updateSource(&sources, name, value, showAll, force, forcePinned); err != nil { return err } else if updated { updates = append(updates, name) @@ -206,7 +211,7 @@ func main() { } else { name := c.Args().Get(0) - if updated, err := updateSource(&sources, name, sources[name], showAll, force); err != nil { + if updated, err := updateSource(&sources, name, sources[name], showAll, force, forcePinned); err != nil { return err } else if updated { updates = append(updates, name) @@ -306,14 +311,14 @@ func fetchLatestGitTag(source Source, show bool) (string, error) { return "", fmt.Errorf("source is not a git repository") } -func updateSource(sources *Sources, name string, source Source, show bool, force bool) (bool, error) { +func updateSource(sources *Sources, name string, source Source, show bool, force bool, forcePinned bool) (bool, error) { updated := false if !sources.Exists(name) { return updated, fmt.Errorf("source does not exist") } - if source.Pinned { + if source.Pinned && !forcePinned { if show { fmt.Println("skipped update for", name, "because it is pinned") } |