mirror of
https://github.com/containers/podman.git
synced 2025-06-22 01:48:54 +08:00
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>
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user