github.com/ncdc/docker@v0.10.1-0.20160129113957-6c6729ef5b74/api/client/unpause.go (about)

     1  package client
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  
     7  	Cli "github.com/docker/docker/cli"
     8  	flag "github.com/docker/docker/pkg/mflag"
     9  )
    10  
    11  // CmdUnpause unpauses all processes within a container, for one or more containers.
    12  //
    13  // Usage: docker unpause CONTAINER [CONTAINER...]
    14  func (cli *DockerCli) CmdUnpause(args ...string) error {
    15  	cmd := Cli.Subcmd("unpause", []string{"CONTAINER [CONTAINER...]"}, Cli.DockerCommands["unpause"].Description, true)
    16  	cmd.Require(flag.Min, 1)
    17  
    18  	cmd.ParseFlags(args, true)
    19  
    20  	var errs []string
    21  	for _, name := range cmd.Args() {
    22  		if err := cli.client.ContainerUnpause(name); err != nil {
    23  			errs = append(errs, fmt.Sprintf("Failed to unpause container (%s): %s", name, err))
    24  		} else {
    25  			fmt.Fprintf(cli.out, "%s\n", name)
    26  		}
    27  	}
    28  	if len(errs) > 0 {
    29  		return fmt.Errorf("%s", strings.Join(errs, "\n"))
    30  	}
    31  	return nil
    32  }