aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/utils.go
diff options
context:
space:
mode:
authorAdrian Reber <areber@redhat.com>2018-10-16 12:04:45 +0000
committerAdrian Reber <adrian@lisas.de>2018-10-23 17:01:30 +0200
commitfea37b387c746471177f90f15b04d7735a88e621 (patch)
tree77b4bf6ae101c001ed543e44daa7b5cbec497404 /cmd/podman/utils.go
parent215cf7b8984f687a79ce6055e350ee3e75d81b79 (diff)
downloadpodman-fea37b387c746471177f90f15b04d7735a88e621.tar.gz
podman-fea37b387c746471177f90f15b04d7735a88e621.tar.bz2
podman-fea37b387c746471177f90f15b04d7735a88e621.zip
Use the new checkAllAndLatest() function
Instead of duplicating the same code in multiple commands this uses the newly added function checkAllAndLatest() instead. Signed-off-by: Adrian Reber <areber@redhat.com>
Diffstat (limited to 'cmd/podman/utils.go')
-rw-r--r--cmd/podman/utils.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/cmd/podman/utils.go b/cmd/podman/utils.go
index b193cf889..f9971fd88 100644
--- a/cmd/podman/utils.go
+++ b/cmd/podman/utils.go
@@ -160,15 +160,8 @@ func (f *RawTtyFormatter) Format(entry *logrus.Entry) ([]byte, error) {
}
func checkMutuallyExclusiveFlags(c *cli.Context) error {
- argLen := len(c.Args())
- if (c.Bool("all") || c.Bool("latest")) && argLen > 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 argLen < 1 && !c.Bool("all") && !c.Bool("latest") {
- return errors.Errorf("you must provide at least one pod name or id")
+ if err := checkAllAndLatest(c); err != nil {
+ return err
}
if err := validateFlags(c, startFlags); err != nil {
return err