From a5ad36c65ea07d839fd9bf55a820c8cb9884eed1 Mon Sep 17 00:00:00 2001 From: Jakub Guzik Date: Thu, 3 Jun 2021 22:48:43 +0200 Subject: 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 --- cmd/podman/images/prune.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cmd/podman/images/prune.go') 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 -- cgit v1.2.3-54-g00ecf