⛩️ 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): add listed output for update

Fuwn e50122ce 976d3d4d

+20 -2
+20 -2
yae.go
··· 165 165 Name: "show-updated-only", 166 166 Usage: "Output a newline-seperated list of updated sources, silence other output", 167 167 }, 168 + &cli.BoolFlag{ 169 + Name: "show-updated-only-formatted", 170 + Usage: "Output a comma and/or ampersand list of updated sources, silence other output", 171 + }, 168 172 }, 169 173 Action: func(c *cli.Context) error { 170 - showAll := !c.Bool("show-updated-only") 174 + showAll := !c.Bool("show-updated-only") && !c.Bool("show-updated-only-formatted") 171 175 updates := []string{} 172 176 173 177 if c.Args().Len() == 0 { ··· 192 196 return err 193 197 } 194 198 195 - if !showAll { 199 + if c.Bool("show-updated-only") { 196 200 for _, update := range updates { 197 201 fmt.Println(update) 198 202 } 203 + } else if c.Bool("show-updated-only-formatted") { 204 + fmt.Println(lister(updates)) 199 205 } 200 206 201 207 return nil ··· 320 326 321 327 return updated, nil 322 328 } 329 + 330 + func lister(items []string) string { 331 + if len(items) == 0 { 332 + return "" 333 + } else if len(items) == 1 { 334 + return items[0] 335 + } else if len(items) == 2 { 336 + return fmt.Sprintf("%s & %s", items[0], items[1]) 337 + } 338 + 339 + return fmt.Sprintf("%s, & %s", strings.Join(items[:len(items)-1], ", "), items[len(items)-1]) 340 + }