mirror of
https://github.com/containers/podman.git
synced 2025-06-06 15:00:40 +08:00
Merge pull request #2406 from rhatdan/errors
Exit with errors not just logging error
This commit is contained in:
@ -74,19 +74,16 @@ func pullCmd(c *cliconfig.PullValues) error {
|
|||||||
|
|
||||||
args := c.InputArgs
|
args := c.InputArgs
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
logrus.Errorf("an image name must be specified")
|
return errors.Errorf("an image name must be specified")
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
if len(args) > 1 {
|
if len(args) > 1 {
|
||||||
logrus.Errorf("too many arguments. Requires exactly 1")
|
return errors.Errorf("too many arguments. Requires exactly 1")
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
arr := strings.SplitN(args[0], ":", 2)
|
arr := strings.SplitN(args[0], ":", 2)
|
||||||
if len(arr) == 2 {
|
if len(arr) == 2 {
|
||||||
if c.Bool("all-tags") {
|
if c.Bool("all-tags") {
|
||||||
logrus.Errorf("tag can't be used with --all-tags")
|
return errors.Errorf("tag can't be used with --all-tags")
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx := getContext()
|
ctx := getContext()
|
||||||
|
@ -13,7 +13,6 @@ import (
|
|||||||
"github.com/containers/libpod/libpod/image"
|
"github.com/containers/libpod/libpod/image"
|
||||||
"github.com/containers/libpod/utils"
|
"github.com/containers/libpod/utils"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -87,8 +86,7 @@ func runlabelCmd(c *cliconfig.RunlabelValues) error {
|
|||||||
|
|
||||||
args := c.InputArgs
|
args := c.InputArgs
|
||||||
if len(args) < 2 {
|
if len(args) < 2 {
|
||||||
logrus.Errorf("the runlabel command requires at least 2 arguments: LABEL IMAGE")
|
return errors.Errorf("the runlabel command requires at least 2 arguments: LABEL IMAGE")
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
if c.Display && c.Quiet {
|
if c.Display && c.Quiet {
|
||||||
return errors.Errorf("the display and quiet flags cannot be used together.")
|
return errors.Errorf("the display and quiet flags cannot be used together.")
|
||||||
|
Reference in New Issue
Block a user