Files
podman/vendor/github.com/containers/buildah/pkg/completion/completion.go
Paul Holzinger 83a0299309 vendor: update buildah to latest
Includes a fix for CVE-2024-9407

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-02 18:04:39 +02:00

24 lines
766 B
Go

package completion
import (
"strings"
"github.com/spf13/cobra"
)
/* Autocomplete Functions for cobra ValidArgsFunction */
// AutocompleteNamespaceFlag - Autocomplete the userns flag.
// -> host, private, container, ns:[path], [path]
func AutocompleteNamespaceFlag(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
var completions []string
// If we don't filter on "toComplete", zsh and fish will not do file completion
// even if the prefix typed by the user does not match the returned completions
for _, comp := range []string{"host", "private", "container", "ns:"} {
if strings.HasPrefix(comp, toComplete) {
completions = append(completions, comp)
}
}
return completions, cobra.ShellCompDirectiveDefault
}