summaryrefslogtreecommitdiff
path: root/cmd/podman/images/prune.go
diff options
context:
space:
mode:
authorJakub Guzik <jakubmguzik@gmail.com>2021-06-03 22:48:43 +0200
committerJakub Guzik <jakubmguzik@gmail.com>2021-06-08 15:18:00 +0200
commita5ad36c65ea07d839fd9bf55a820c8cb9884eed1 (patch)
tree54f8725dccf2ec1f313ab3f775293e14a4def747 /cmd/podman/images/prune.go
parent9a3a7327fdafaac66c99130a6729e4bcde8df0b0 (diff)
downloadpodman-a5ad36c65ea07d839fd9bf55a820c8cb9884eed1.tar.gz
podman-a5ad36c65ea07d839fd9bf55a820c8cb9884eed1.tar.bz2
podman-a5ad36c65ea07d839fd9bf55a820c8cb9884eed1.zip
Fix image prune --filter cmd behavior
Image prune --filter is fully implemented in the api, http api yet not connected with the cli execution. User trying to use filters does not see the effect. This commit adds glue code to enable possiblity of using --filter in prune in the cli execution. Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
Diffstat (limited to 'cmd/podman/images/prune.go')
-rw-r--r--cmd/podman/images/prune.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd/podman/images/prune.go b/cmd/podman/images/prune.go
index a082255f6..6ecf4f2aa 100644
--- a/cmd/podman/images/prune.go
+++ b/cmd/podman/images/prune.go
@@ -59,7 +59,15 @@ func prune(cmd *cobra.Command, args []string) error {
return nil
}
}
-
+ filterMap, err := common.ParseFilters(filter)
+ if err != nil {
+ return err
+ }
+ for k, v := range filterMap {
+ for _, val := range v {
+ pruneOpts.Filter = append(pruneOpts.Filter, fmt.Sprintf("%s=%s", k, val))
+ }
+ }
results, err := registry.ImageEngine().Prune(registry.GetContext(), pruneOpts)
if err != nil {
return err