/
left76
/
ccli2
Обзор
Документация
Войти
/
left76
/
ccli2
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
cli/command/container/unpause.go
50 строк
1 KB
Kir Kolyshkin
Switch from x/net/context to context
12 май 2018, 02:49
12 май 2018, 02:49
6f8070d
Код
Авторство
О чём код?
package container import ( "context" "fmt" "strings" "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" "github.com/pkg/errors" "github.com/spf13/cobra" ) type unpauseOptions struct { containers []string } // NewUnpauseCommand creates a new cobra.Command for `docker unpause` func NewUnpauseCommand(dockerCli command.Cli) *cobra.Command { var opts unpauseOptions cmd := &cobra.Command{ Use: "unpause CONTAINER [CONTAINER...]", Short: "Unpause all processes within one or more containers", Args: cli.RequiresMinArgs(1), RunE: func(cmd *cobra.Command, args []string) error { opts.containers = args return runUnpause(dockerCli, &opts) }, } return cmd } func runUnpause(dockerCli command.Cli, opts *unpauseOptions) error { ctx := context.Background() var errs []string errChan := parallelOperation(ctx, opts.containers, dockerCli.Client().ContainerUnpause) for _, container := range opts.containers { if err := <-errChan; err != nil { errs = append(errs, err.Error()) continue } fmt.Fprintln(dockerCli.Out(), container) } if len(errs) > 0 { return errors.New(strings.Join(errs, "\n")) } return nil }