Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark filename flags for completions #22877

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
82 changes: 82 additions & 0 deletions contrib/completions/bash/kubectl
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,11 @@ _kubectl_get()
flags+=("--show-labels")
flags+=("--sort-by=")
flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--watch")
flags+=("-w")
flags+=("--watch-only")
Expand Down Expand Up @@ -435,12 +439,18 @@ _kubectl_create_namespace()
flags+=("--output-version=")
flags+=("--save-config")
flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--show-all")
flags+=("-a")
flags+=("--show-labels")
flags+=("--sort-by=")
flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--validate")
flags+=("--alsologtostderr")
flags+=("--api-version=")
Expand Down Expand Up @@ -494,12 +504,18 @@ _kubectl_create_secret_docker-registry()
flags+=("--output-version=")
flags+=("--save-config")
flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--show-all")
flags+=("-a")
flags+=("--show-labels")
flags+=("--sort-by=")
flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--validate")
flags+=("--alsologtostderr")
flags+=("--api-version=")
Expand Down Expand Up @@ -553,12 +569,18 @@ _kubectl_create_secret_generic()
flags+=("--output-version=")
flags+=("--save-config")
flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--show-all")
flags+=("-a")
flags+=("--show-labels")
flags+=("--sort-by=")
flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--type=")
flags+=("--validate")
flags+=("--alsologtostderr")
Expand Down Expand Up @@ -651,12 +673,18 @@ _kubectl_create_configmap()
flags+=("--output-version=")
flags+=("--save-config")
flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--show-all")
flags+=("-a")
flags+=("--show-labels")
flags+=("--sort-by=")
flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--validate")
flags+=("--alsologtostderr")
flags+=("--api-version=")
Expand Down Expand Up @@ -706,12 +734,18 @@ _kubectl_create_serviceaccount()
flags+=("--output-version=")
flags+=("--save-config")
flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--show-all")
flags+=("-a")
flags+=("--show-labels")
flags+=("--sort-by=")
flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--validate")
flags+=("--alsologtostderr")
flags+=("--api-version=")
Expand Down Expand Up @@ -770,6 +804,8 @@ _kubectl_create()
flags+=("-R")
flags+=("--save-config")
flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--validate")
flags+=("--alsologtostderr")
flags+=("--api-version=")
Expand Down Expand Up @@ -829,6 +865,8 @@ _kubectl_replace()
flags+=("-R")
flags+=("--save-config")
flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--timeout=")
flags+=("--validate")
flags+=("--alsologtostderr")
Expand Down Expand Up @@ -1077,6 +1115,8 @@ _kubectl_apply()
flags+=("--recursive")
flags+=("-R")
flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--validate")
flags+=("--alsologtostderr")
flags+=("--api-version=")
Expand Down Expand Up @@ -1228,12 +1268,18 @@ _kubectl_rolling-update()
flags+=("--poll-interval=")
flags+=("--rollback")
flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--show-all")
flags+=("-a")
flags+=("--show-labels")
flags+=("--sort-by=")
flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--timeout=")
flags+=("--update-period=")
flags+=("--validate")
Expand Down Expand Up @@ -1677,7 +1723,11 @@ _kubectl_run()
flags+=("--stdin")
flags+=("-i")
flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--tty")
flags+=("--alsologtostderr")
flags+=("--api-version=")
Expand Down Expand Up @@ -1753,7 +1803,11 @@ _kubectl_expose()
flags+=("--sort-by=")
flags+=("--target-port=")
flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--type=")
flags+=("--alsologtostderr")
flags+=("--api-version=")
Expand Down Expand Up @@ -1820,7 +1874,11 @@ _kubectl_autoscale()
flags+=("--show-labels")
flags+=("--sort-by=")
flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--alsologtostderr")
flags+=("--api-version=")
flags+=("--certificate-authority=")
Expand Down Expand Up @@ -2119,7 +2177,11 @@ _kubectl_label()
flags+=("--show-labels")
flags+=("--sort-by=")
flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--alsologtostderr")
flags+=("--api-version=")
flags+=("--certificate-authority=")
Expand Down Expand Up @@ -2208,7 +2270,11 @@ _kubectl_annotate()
flags+=("--show-labels")
flags+=("--sort-by=")
flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--alsologtostderr")
flags+=("--api-version=")
flags+=("--certificate-authority=")
Expand Down Expand Up @@ -2261,7 +2327,11 @@ _kubectl_config_view()
flags+=("--show-labels")
flags+=("--sort-by=")
flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--alsologtostderr")
flags+=("--api-version=")
flags+=("--certificate-authority=")
Expand Down Expand Up @@ -2303,6 +2373,8 @@ _kubectl_config_set-cluster()

flags+=("--api-version=")
flags+=("--certificate-authority=")
flags_with_completion+=("--certificate-authority")
flags_completion+=("_filedir")
flags+=("--embed-certs=")
flags+=("--insecure-skip-tls-verify=")
flags+=("--server=")
Expand Down Expand Up @@ -2341,7 +2413,11 @@ _kubectl_config_set-credentials()
flags_completion=()

flags+=("--client-certificate=")
flags_with_completion+=("--client-certificate")
flags_completion+=("_filedir")
flags+=("--client-key=")
flags_with_completion+=("--client-key")
flags_completion+=("_filedir")
flags+=("--embed-certs=")
flags+=("--password=")
flags+=("--token=")
Expand Down Expand Up @@ -2798,12 +2874,18 @@ _kubectl_convert()
flags+=("--recursive")
flags+=("-R")
flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--show-all")
flags+=("-a")
flags+=("--show-labels")
flags+=("--sort-by=")
flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--validate")
flags+=("--alsologtostderr")
flags+=("--api-version=")
Expand Down
2 changes: 1 addition & 1 deletion docs/man/man1/kubectl-config-set-cluster.1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Specifying a name that already exists will merge new fields on top of existing v

.PP
\fB\-\-certificate\-authority\fP=""
path to certificate\-authority for the cluster entry in kubeconfig
path to certificate\-authority file for the cluster entry in kubeconfig

.PP
\fB\-\-embed\-certs\fP=false
Expand Down
4 changes: 2 additions & 2 deletions docs/man/man1/kubectl-config-set-credentials.1
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ Bearer token and basic auth are mutually exclusive.
.SH OPTIONS
.PP
\fB\-\-client\-certificate\fP=""
path to client\-certificate for the user entry in kubeconfig
path to client\-certificate file for the user entry in kubeconfig

.PP
\fB\-\-client\-key\fP=""
path to client\-key for the user entry in kubeconfig
path to client\-key file for the user entry in kubeconfig

.PP
\fB\-\-embed\-certs\fP=false
Expand Down
4 changes: 2 additions & 2 deletions docs/user-guide/kubectl/kubectl_config_set-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ kubectl config set-cluster e2e --insecure-skip-tls-verify=true

```
--api-version="": api-version for the cluster entry in kubeconfig
--certificate-authority="": path to certificate-authority for the cluster entry in kubeconfig
--certificate-authority="": path to certificate-authority file for the cluster entry in kubeconfig
--embed-certs[=false]: embed-certs for the cluster entry in kubeconfig
--insecure-skip-tls-verify[=false]: insecure-skip-tls-verify for the cluster entry in kubeconfig
--server="": server for the cluster entry in kubeconfig
Expand Down Expand Up @@ -97,7 +97,7 @@ kubectl config set-cluster e2e --insecure-skip-tls-verify=true

* [kubectl config](kubectl_config.md) - config modifies kubeconfig files

###### Auto generated by spf13/cobra on 23-Mar-2016
###### Auto generated by spf13/cobra on 1-Apr-2016

<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_set-cluster.md?pixel)]()
Expand Down
6 changes: 3 additions & 3 deletions docs/user-guide/kubectl/kubectl_config_set-credentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ kubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.
### Options

```
--client-certificate="": path to client-certificate for the user entry in kubeconfig
--client-key="": path to client-key for the user entry in kubeconfig
--client-certificate="": path to client-certificate file for the user entry in kubeconfig
--client-key="": path to client-key file for the user entry in kubeconfig
--embed-certs[=false]: embed client cert/key for the user entry in kubeconfig
--password="": password for the user entry in kubeconfig
--token="": token for the user entry in kubeconfig
Expand Down Expand Up @@ -109,7 +109,7 @@ kubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.

* [kubectl config](kubectl_config.md) - config modifies kubeconfig files

###### Auto generated by spf13/cobra on 23-Mar-2016
###### Auto generated by spf13/cobra on 1-Apr-2016

<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_set-credentials.md?pixel)]()
Expand Down
6 changes: 4 additions & 2 deletions pkg/kubectl/cmd/config/create_authinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ func NewCmdConfigSetAuthInfo(out io.Writer, configAccess ConfigAccess) *cobra.Co
},
}

cmd.Flags().Var(&options.clientCertificate, clientcmd.FlagCertFile, "path to "+clientcmd.FlagCertFile+" for the user entry in kubeconfig")
cmd.Flags().Var(&options.clientKey, clientcmd.FlagKeyFile, "path to "+clientcmd.FlagKeyFile+" for the user entry in kubeconfig")
cmd.Flags().Var(&options.clientCertificate, clientcmd.FlagCertFile, "path to "+clientcmd.FlagCertFile+" file for the user entry in kubeconfig")
cmd.MarkFlagFilename(clientcmd.FlagCertFile)
cmd.Flags().Var(&options.clientKey, clientcmd.FlagKeyFile, "path to "+clientcmd.FlagKeyFile+" file for the user entry in kubeconfig")
cmd.MarkFlagFilename(clientcmd.FlagKeyFile)
cmd.Flags().Var(&options.token, clientcmd.FlagBearerToken, clientcmd.FlagBearerToken+" for the user entry in kubeconfig")
cmd.Flags().Var(&options.username, clientcmd.FlagUsername, clientcmd.FlagUsername+" for the user entry in kubeconfig")
cmd.Flags().Var(&options.password, clientcmd.FlagPassword, clientcmd.FlagPassword+" for the user entry in kubeconfig")
Expand Down
3 changes: 2 additions & 1 deletion pkg/kubectl/cmd/config/create_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ func NewCmdConfigSetCluster(out io.Writer, configAccess ConfigAccess) *cobra.Com
cmd.Flags().Var(&options.apiVersion, clientcmd.FlagAPIVersion, clientcmd.FlagAPIVersion+" for the cluster entry in kubeconfig")
f := cmd.Flags().VarPF(&options.insecureSkipTLSVerify, clientcmd.FlagInsecure, "", clientcmd.FlagInsecure+" for the cluster entry in kubeconfig")
f.NoOptDefVal = "true"
cmd.Flags().Var(&options.certificateAuthority, clientcmd.FlagCAFile, "path to "+clientcmd.FlagCAFile+" for the cluster entry in kubeconfig")
cmd.Flags().Var(&options.certificateAuthority, clientcmd.FlagCAFile, "path to "+clientcmd.FlagCAFile+" file for the cluster entry in kubeconfig")
cmd.MarkFlagFilename(clientcmd.FlagCAFile)
f = cmd.Flags().VarPF(&options.embedCAData, clientcmd.FlagEmbedCerts, "", clientcmd.FlagEmbedCerts+" for the cluster entry in kubeconfig")
f.NoOptDefVal = "true"

Expand Down
1 change: 1 addition & 0 deletions pkg/kubectl/cmd/util/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ func GetFlagDuration(cmd *cobra.Command, flag string) time.Duration {
func AddValidateFlags(cmd *cobra.Command) {
cmd.Flags().Bool("validate", true, "If true, use a schema to validate the input before sending it")
cmd.Flags().String("schema-cache-dir", fmt.Sprintf("~/%s/%s", clientcmd.RecommendedHomeDir, clientcmd.RecommendedSchemaName), fmt.Sprintf("If non-empty, load/store cached API schemas in this directory, default is '$HOME/%s/%s'", clientcmd.RecommendedHomeDir, clientcmd.RecommendedSchemaName))
cmd.MarkFlagFilename("schema-cache-dir")
}

func AddRecursiveFlag(cmd *cobra.Command, value *bool) {
Expand Down
1 change: 1 addition & 0 deletions pkg/kubectl/cmd/util/printing.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func AddPrinterFlags(cmd *cobra.Command) {
// template shorthand -t is deprecated to support -t for --tty
// TODO: remove template flag shorthand -t
cmd.Flags().StringP("template", "t", "", "Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].")
cmd.MarkFlagFilename("template")
cmd.Flags().MarkShorthandDeprecated("template", "please use --template instead")
cmd.Flags().String("sort-by", "", "If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.")
cmd.Flags().BoolP("show-all", "a", false, "When printing, show all resources (default hide terminated pods.)")
Expand Down