summaryrefslogtreecommitdiff
path: root/cmd/kpod/rmi.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2017-12-15 16:58:36 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2017-12-18 16:46:05 +0000
commit5770dc2640c216525ab84031e3712fcc46b3b087 (patch)
tree8a1c5c4e4a6ce6a35a3767247623a62bfd698f77 /cmd/kpod/rmi.go
parentde3468e120d489d046c08dad72ba2262e222ccb1 (diff)
downloadpodman-5770dc2640c216525ab84031e3712fcc46b3b087.tar.gz
podman-5770dc2640c216525ab84031e3712fcc46b3b087.tar.bz2
podman-5770dc2640c216525ab84031e3712fcc46b3b087.zip
Rename all references to kpod to podman
The decision is in, kpod is going to be named podman. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #145 Approved by: umohnani8
Diffstat (limited to 'cmd/kpod/rmi.go')
-rw-r--r--cmd/kpod/rmi.go75
1 files changed, 0 insertions, 75 deletions
diff --git a/cmd/kpod/rmi.go b/cmd/kpod/rmi.go
deleted file mode 100644
index 1b4cb7390..000000000
--- a/cmd/kpod/rmi.go
+++ /dev/null
@@ -1,75 +0,0 @@
-package main
-
-import (
- "fmt"
-
- "github.com/pkg/errors"
- "github.com/projectatomic/libpod/libpod"
- "github.com/urfave/cli"
-)
-
-var (
- rmiDescription = "removes one or more locally stored images."
- rmiFlags = []cli.Flag{
- cli.BoolFlag{
- Name: "all, a",
- Usage: "remove all images",
- },
- cli.BoolFlag{
- Name: "force, f",
- Usage: "force removal of the image",
- },
- }
- rmiCommand = cli.Command{
- Name: "rmi",
- Usage: "removes one or more images from local storage",
- Description: rmiDescription,
- Action: rmiCmd,
- ArgsUsage: "IMAGE-NAME-OR-ID [...]",
- Flags: rmiFlags,
- UseShortOptionHandling: true,
- }
-)
-
-func rmiCmd(c *cli.Context) error {
- if err := validateFlags(c, rmiFlags); err != nil {
- return err
- }
- removeAll := c.Bool("all")
- runtime, err := getRuntime(c)
- if err != nil {
- return errors.Wrapf(err, "could not get runtime")
- }
- defer runtime.Shutdown(false)
-
- args := c.Args()
- if len(args) == 0 && !removeAll {
- return errors.Errorf("image name or ID must be specified")
- }
- if len(args) > 0 && removeAll {
- return errors.Errorf("when using the --all switch, you may not pass any images names or IDs")
- }
- imagesToDelete := args[:]
- if removeAll {
- localImages, err := runtime.GetImages(&libpod.ImageFilterParams{})
- if err != nil {
- return errors.Wrapf(err, "unable to query local images")
- }
- for _, image := range localImages {
- imagesToDelete = append(imagesToDelete, image.ID)
- }
- }
-
- for _, arg := range imagesToDelete {
- image, err := runtime.GetImage(arg)
- if err != nil {
- return errors.Wrapf(err, "could not get image %q", arg)
- }
- id, err := runtime.RemoveImage(image, c.Bool("force"))
- if err != nil {
- return errors.Wrapf(err, "error removing image %q", id)
- }
- fmt.Printf("%s\n", id)
- }
- return nil
-}