From 781dcbd1969717bbb645b6fc62731fa1fd968d1f Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Fri, 24 May 2024 16:57:25 -0700 Subject: [PATCH] prune: allow negative and prefix filters Signed-off-by: Tonis Tiigi --- commands/prune.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/commands/prune.go b/commands/prune.go index e2821721..67ac9bd3 100644 --- a/commands/prune.go +++ b/commands/prune.go @@ -195,6 +195,8 @@ func toBuildkitPruneInfo(f filters.Args) (*client.PruneInfo, error) { case 1: if filterKey == "id" { filters = append(filters, filterKey+"~="+values[0]) + } else if strings.HasSuffix(filterKey, "!") || strings.HasSuffix(filterKey, "~") { + filters = append(filters, filterKey+"="+values[0]) } else { filters = append(filters, filterKey+"=="+values[0]) }