From cf4967de4d4e4abeb183217dfee130d8ec2e02f5 Mon Sep 17 00:00:00 2001
From: Paul Holzinger <paul.holzinger@web.de>
Date: Sat, 14 Nov 2020 16:50:02 +0100
Subject: Improve the shell completion api

One main advantage of the new shell completion logic is that
we can easly parse flags and adjust based on the given flags
the suggestions. For example some commands accept the
`--latest` flag only if no arguments are given.

This commit implements this logic in a simple maintainable way
since it reuses the already existing `Args` function in the
cmd struct.

I also refactored the `getXXX` function to match based on the
namei/id which could speed up the shell completion with many
containers, images, etc...

I also added the degraded status to the valid pod status
filters which was implemented in #8081.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
---
 libpod/filters/pods.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'libpod')

diff --git a/libpod/filters/pods.go b/libpod/filters/pods.go
index 7d12eefa6..3cd97728f 100644
--- a/libpod/filters/pods.go
+++ b/libpod/filters/pods.go
@@ -88,7 +88,7 @@ func GeneratePodFilterFunc(filter, filterValue string) (
 			return match
 		}, nil
 	case "status":
-		if !util.StringInSlice(filterValue, []string{"stopped", "running", "paused", "exited", "dead", "created"}) {
+		if !util.StringInSlice(filterValue, []string{"stopped", "running", "paused", "exited", "dead", "created", "degraded"}) {
 			return nil, errors.Errorf("%s is not a valid pod status", filterValue)
 		}
 		return func(p *libpod.Pod) bool {
-- 
cgit v1.2.3-54-g00ecf