diff options
Diffstat (limited to 'cmd/podman/stop.go')
-rw-r--r-- | cmd/podman/stop.go | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/cmd/podman/stop.go b/cmd/podman/stop.go index ff0b36bf1..f5c0fca85 100644 --- a/cmd/podman/stop.go +++ b/cmd/podman/stop.go @@ -44,16 +44,11 @@ var ( ) func stopCmd(c *cli.Context) error { - args := c.Args() - if (c.Bool("all") || c.Bool("latest")) && len(args) > 0 { - return errors.Errorf("no arguments are needed with --all or --latest") - } - if c.Bool("all") && c.Bool("latest") { - return errors.Errorf("--all and --latest cannot be used together") - } - if len(args) < 1 && !c.Bool("all") && !c.Bool("latest") { - return errors.Errorf("you must provide at least one container name or id") + + if err := checkAllAndLatest(c); err != nil { + return err } + if err := validateFlags(c, stopFlags); err != nil { return err } @@ -86,6 +81,7 @@ func stopCmd(c *cli.Context) error { } containers = append(containers, lastCtr) } else { + args := c.Args() for _, i := range args { container, err := runtime.LookupContainer(i) if err != nil { |