Rename getAndExecute -> execForEach

This commit is contained in:
Joel Elkins 2022-07-31 00:57:18 -05:00
parent c347bd9311
commit e56d2c12d2
No known key found for this signature in database
GPG Key ID: 133589DC38921AE2
9 changed files with 9 additions and 9 deletions

View File

@ -38,7 +38,7 @@ var createCmd = &cobra.Command{
names or categories. Multiple arguments are supported.`, names or categories. Multiple arguments are supported.`,
Run: func(_ *cobra.Command, args []string) { Run: func(_ *cobra.Command, args []string) {
conts := config.Union(args, contMask) conts := config.Union(args, contMask)
getAndExecute(conts, func(c *container.Container) command.CommandSet { return c.CreateCommands() }) execForEach(conts, func(c *container.Container) command.CommandSet { return c.CreateCommands() })
}, },
} }

View File

@ -29,7 +29,7 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
func getAndExecute(tgts []container.Container, getSet func(*container.Container) command.CommandSet) { func execForEach(tgts []container.Container, getSet func(*container.Container) command.CommandSet) {
var wg sync.WaitGroup var wg sync.WaitGroup
for i := range tgts { for i := range tgts {
wg.Add(1) wg.Add(1)

View File

@ -39,7 +39,7 @@ affected: the old image will still remain, though untagged, and any defined cont
will still use it.`, will still use it.`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
conts := config.Union(args, contMask) conts := config.Union(args, contMask)
getAndExecute(conts, func(c *container.Container) command.CommandSet { return c.PullCommands() }) execForEach(conts, func(c *container.Container) command.CommandSet { return c.PullCommands() })
}, },
} }

View File

@ -38,7 +38,7 @@ var recreateCmd = &cobra.Command{
one or more container names or categories. If empty, "all" is assumed.`, one or more container names or categories. If empty, "all" is assumed.`,
Run: func(_ *cobra.Command, args []string) { Run: func(_ *cobra.Command, args []string) {
conts := config.Union(args, contMask) conts := config.Union(args, contMask)
getAndExecute(conts, func(c *container.Container) command.CommandSet { return c.RecreateCommands() }) execForEach(conts, func(c *container.Container) command.CommandSet { return c.RecreateCommands() })
}, },
} }

View File

@ -38,7 +38,7 @@ var restartCmd = &cobra.Command{
one or more container names or categories. If empty, "all" is assumed.`, one or more container names or categories. If empty, "all" is assumed.`,
Run: func(_ *cobra.Command, args []string) { Run: func(_ *cobra.Command, args []string) {
conts := config.Union(args, contMask) conts := config.Union(args, contMask)
getAndExecute(conts, func(c *container.Container) command.CommandSet { return c.RestartCommands() }) execForEach(conts, func(c *container.Container) command.CommandSet { return c.RestartCommands() })
}, },
} }

View File

@ -39,7 +39,7 @@ var rmCmd = &cobra.Command{
If running, they will first be stopped.`, If running, they will first be stopped.`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
conts := config.Union(args, contMask) conts := config.Union(args, contMask)
getAndExecute(conts, func(c *container.Container) command.CommandSet { return c.RemoveCommands() }) execForEach(conts, func(c *container.Container) command.CommandSet { return c.RemoveCommands() })
}, },
} }

View File

@ -38,7 +38,7 @@ var startCmd = &cobra.Command{
one or more container names or categories. If empty, "all" is assumed.`, one or more container names or categories. If empty, "all" is assumed.`,
Run: func(_ *cobra.Command, args []string) { Run: func(_ *cobra.Command, args []string) {
conts := config.Union(args, contMask) conts := config.Union(args, contMask)
getAndExecute(conts, func(c *container.Container) command.CommandSet { return c.StartCommands() }) execForEach(conts, func(c *container.Container) command.CommandSet { return c.StartCommands() })
}, },
} }

View File

@ -38,7 +38,7 @@ var stopCmd = &cobra.Command{
one or more container names or categories. If empty, "all" is assumed.`, one or more container names or categories. If empty, "all" is assumed.`,
Run: func(_ *cobra.Command, args []string) { Run: func(_ *cobra.Command, args []string) {
conts := config.Union(args, contMask) conts := config.Union(args, contMask)
getAndExecute(conts, func(c *container.Container) command.CommandSet { return c.StopCommands() }) execForEach(conts, func(c *container.Container) command.CommandSet { return c.StopCommands() })
}, },
} }

View File

@ -38,7 +38,7 @@ var updateCmd = &cobra.Command{
one or more container names or categories. If empty, "all" is assumed.`, one or more container names or categories. If empty, "all" is assumed.`,
Run: func(_ *cobra.Command, args []string) { Run: func(_ *cobra.Command, args []string) {
conts := config.Union(args, contMask) conts := config.Union(args, contMask)
getAndExecute(conts, func(c *container.Container) command.CommandSet { return c.UpdateCommands() }) execForEach(conts, func(c *container.Container) command.CommandSet { return c.UpdateCommands() })
}, },
} }