⛩️ Powerful yet Minimal Nix Dependency Manager
flake flakes home-manager nixos go nix dependency dependencies
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(yae): force recalculate hash flag

Fuwn 0f60ae6d 961f1a30

+15 -4
+15 -4
yae.go
··· 185 185 Name: "show-updated-only-formatted", 186 186 Usage: "Output a comma and/or ampersand list of updated sources, silence other output", 187 187 }, 188 + &cli.BoolFlag{ 189 + Name: "force-hashed", 190 + Usage: "Force updates to non-pinned sources that have an unchanged version (recalculate hash)", 191 + }, 188 192 }, 189 193 Action: func(c *cli.Context) error { 190 194 showAll := !c.Bool("show-updated-only") && !c.Bool("show-updated-only-formatted") 191 195 updates := []string{} 196 + force := c.Bool("force-hashed") 192 197 193 198 if c.Args().Len() == 0 { 194 199 for name, value := range sources { 195 - if updated, err := updateSource(&sources, name, value, showAll); err != nil { 200 + if updated, err := updateSource(&sources, name, value, showAll, force); err != nil { 196 201 return err 197 202 } else if updated { 198 203 updates = append(updates, name) ··· 201 206 } else { 202 207 name := c.Args().Get(0) 203 208 204 - if updated, err := updateSource(&sources, name, sources[name], showAll); err != nil { 209 + if updated, err := updateSource(&sources, name, sources[name], showAll, force); err != nil { 205 210 return err 206 211 } else if updated { 207 212 updates = append(updates, name) ··· 301 306 return "", fmt.Errorf("source is not a git repository") 302 307 } 303 308 304 - func updateSource(sources *Sources, name string, source Source, show bool) (bool, error) { 309 + func updateSource(sources *Sources, name string, source Source, show bool, force bool) (bool, error) { 305 310 updated := false 306 311 307 312 if !sources.Exists(name) { ··· 323 328 return updated, err 324 329 } 325 330 326 - if tag != source.Version { 331 + if tag != source.Version || force { 327 332 if show { 328 333 fmt.Println("updated version for", name, "from", source.Version, "to", tag) 329 334 } ··· 334 339 if strings.Contains(source.URLTemplate, "{version}") { 335 340 source.URL = strings.ReplaceAll(source.URLTemplate, "{version}", source.Version) 336 341 } 342 + } else { 343 + if show { 344 + fmt.Println("skipped update for", name, "because the version is unchanged") 345 + } 346 + 347 + return updated, nil 337 348 } 338 349 } 339 350