aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/rm.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/rm.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/rm.go')
-rw-r--r--cmd/podman/rm.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go
index 38b1546ff..847ea642d 100644
--- a/cmd/podman/rm.go
+++ b/cmd/podman/rm.go
@@ -63,13 +63,8 @@ func rmCmd(c *cli.Context) error {
}
defer runtime.Shutdown(false)
- args := c.Args()
- if c.Bool("latest") && c.Bool("all") {
- return errors.Errorf("--all and --latest cannot be used together")
- }
-
- if len(args) == 0 && !c.Bool("all") && !c.Bool("latest") {
- return errors.Errorf("specify one or more containers to remove")
+ if err := checkAllAndLatest(c); err != nil {
+ return err
}
if c.Bool("all") {
@@ -84,6 +79,7 @@ func rmCmd(c *cli.Context) error {
}
delContainers = append(delContainers, lastCtr)
} else {
+ args := c.Args()
for _, i := range args {
container, err := runtime.LookupContainer(i)
if err != nil {