• Kubernetes Submit Queue's avatar
    Merge pull request #64371 from CaoShuFeng/invalid_o · bf422b7b
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
    
    fix kubectl -o
    
    Fix kubectl -o error message:
    Before this change:
    ```
    kubectl get pods -o foo
    error: unable to match a printer suitable for the output format "" and the options specified: &get.PrintFlags{JSONYamlPrintFlags:(*genericclioptions.JSONYamlPrintFlags)(0x23aa610), NamePrintFlags:(*genericclioptions.NamePrintFlags)(0xc42058b4e0), TemplateFlags:(*printers.KubeTemplatePrintFlags)(0xc4206765e0), CustomColumnsFlags:(*printers.CustomColumnsPrintFlags)(0xc420676620), HumanReadableFlags:(*get.HumanPrintFlags)(0xc4204eb180), NoHeaders:(*bool)(0xc4206fefbc), OutputFormat:(*string)(0xc42058b4d0)}
    ```
    
    After this change:
    ```
    Kubectl get pods -o foo
    error: unable to match a printer suitable for the output format "foo", allowed formats are: json,yaml,name,template,go-template,go-template-file,templatefile,jsonpath,jsonpath-file,custom-columns-file,custom-columns,wide
    ```
    
    
    
    **What this PR does / why we need it**:
    
    **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
    Fixes #
    
    **Special notes for your reviewer**:
    
    **Release note**:
    
    ```release-note
    kubectl will list all allowed print formats when an invalid format is passed.
    ```
    bf422b7b
Name
Last commit
Last update
..
BUILD Loading commit data...
create.go Loading commit data...
create_clusterrole.go Loading commit data...
create_clusterrole_test.go Loading commit data...
create_clusterrolebinding.go Loading commit data...
create_clusterrolebinding_test.go Loading commit data...
create_configmap.go Loading commit data...
create_configmap_test.go Loading commit data...
create_deployment.go Loading commit data...
create_deployment_test.go Loading commit data...
create_job.go Loading commit data...
create_job_test.go Loading commit data...
create_namespace.go Loading commit data...
create_namespace_test.go Loading commit data...
create_pdb.go Loading commit data...
create_pdb_test.go Loading commit data...
create_priorityclass.go Loading commit data...
create_priorityclass_test.go Loading commit data...
create_quota.go Loading commit data...
create_quota_test.go Loading commit data...
create_role.go Loading commit data...
create_role_test.go Loading commit data...
create_rolebinding.go Loading commit data...
create_rolebinding_test.go Loading commit data...
create_secret.go Loading commit data...
create_secret_test.go Loading commit data...
create_service.go Loading commit data...
create_service_test.go Loading commit data...
create_serviceaccount.go Loading commit data...
create_serviceaccount_test.go Loading commit data...
create_test.go Loading commit data...
flags.go Loading commit data...