mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #12730 from eparis/bash-completions-delete-label
bashcompletions: suggest resources to delete in kubectl delete
This commit is contained in:
		@@ -426,6 +426,21 @@ _kubectl_delete()
 | 
			
		||||
 | 
			
		||||
    must_have_one_flag=()
 | 
			
		||||
    must_have_one_noun=()
 | 
			
		||||
    must_have_one_noun+=("componentstatus")
 | 
			
		||||
    must_have_one_noun+=("endpoints")
 | 
			
		||||
    must_have_one_noun+=("event")
 | 
			
		||||
    must_have_one_noun+=("limitrange")
 | 
			
		||||
    must_have_one_noun+=("namespace")
 | 
			
		||||
    must_have_one_noun+=("node")
 | 
			
		||||
    must_have_one_noun+=("persistentvolume")
 | 
			
		||||
    must_have_one_noun+=("persistentvolumeclaim")
 | 
			
		||||
    must_have_one_noun+=("pod")
 | 
			
		||||
    must_have_one_noun+=("podtemplate")
 | 
			
		||||
    must_have_one_noun+=("replicationcontroller")
 | 
			
		||||
    must_have_one_noun+=("resourcequota")
 | 
			
		||||
    must_have_one_noun+=("secret")
 | 
			
		||||
    must_have_one_noun+=("service")
 | 
			
		||||
    must_have_one_noun+=("serviceaccount")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
_kubectl_namespace()
 | 
			
		||||
 
 | 
			
		||||
@@ -58,6 +58,9 @@ $ kubectl delete pods --all`
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func NewCmdDelete(f *cmdutil.Factory, out io.Writer) *cobra.Command {
 | 
			
		||||
	p := kubectl.NewHumanReadablePrinter(false, false, false, []string{})
 | 
			
		||||
	validArgs := p.HandledResources()
 | 
			
		||||
 | 
			
		||||
	cmd := &cobra.Command{
 | 
			
		||||
		Use:     "delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])",
 | 
			
		||||
		Short:   "Delete resources by filenames, stdin, resources and names, or by resources and label selector.",
 | 
			
		||||
@@ -68,6 +71,7 @@ func NewCmdDelete(f *cmdutil.Factory, out io.Writer) *cobra.Command {
 | 
			
		||||
			err := RunDelete(f, out, cmd, args)
 | 
			
		||||
			cmdutil.CheckErr(err)
 | 
			
		||||
		},
 | 
			
		||||
		ValidArgs: validArgs,
 | 
			
		||||
	}
 | 
			
		||||
	usage := "Filename, directory, or URL to a file containing the resource to delete."
 | 
			
		||||
	kubectl.AddJsonFilenameFlag(cmd, usage)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user