Merge pull request #109070 from VilledeMontreal/feat/compSubresourceFlag

Add shell completion for new --subresource flag
This commit is contained in:
Kubernetes Prow Robot 2022-07-27 13:19:53 -07:00 committed by GitHub
commit 9a73536ff2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -477,6 +477,9 @@ func AddLabelSelectorFlagVar(cmd *cobra.Command, p *string) {
func AddSubresourceFlags(cmd *cobra.Command, subresource *string, usage string, allowedSubresources ...string) {
cmd.Flags().StringVar(subresource, "subresource", "", fmt.Sprintf("%s Must be one of %v. This flag is alpha and may change in the future.", usage, allowedSubresources))
CheckErr(cmd.RegisterFlagCompletionFunc("subresource", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
return allowedSubresources, cobra.ShellCompDirectiveNoFileComp
}))
}
type ValidateOptions struct {