Mark filename flags for completions

pull/6/head
Fabiano Franz 2016-03-11 19:06:42 -03:00
parent bf07a6f5e1
commit 9ddacfa25f
9 changed files with 98 additions and 11 deletions

View File

@ -288,7 +288,11 @@ _kubectl_get()
flags+=("--show-labels") flags+=("--show-labels")
flags+=("--sort-by=") flags+=("--sort-by=")
flags+=("--template=") flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t") two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--watch") flags+=("--watch")
flags+=("-w") flags+=("-w")
flags+=("--watch-only") flags+=("--watch-only")
@ -435,12 +439,18 @@ _kubectl_create_namespace()
flags+=("--output-version=") flags+=("--output-version=")
flags+=("--save-config") flags+=("--save-config")
flags+=("--schema-cache-dir=") flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--show-all") flags+=("--show-all")
flags+=("-a") flags+=("-a")
flags+=("--show-labels") flags+=("--show-labels")
flags+=("--sort-by=") flags+=("--sort-by=")
flags+=("--template=") flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t") two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--validate") flags+=("--validate")
flags+=("--alsologtostderr") flags+=("--alsologtostderr")
flags+=("--api-version=") flags+=("--api-version=")
@ -494,12 +504,18 @@ _kubectl_create_secret_docker-registry()
flags+=("--output-version=") flags+=("--output-version=")
flags+=("--save-config") flags+=("--save-config")
flags+=("--schema-cache-dir=") flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--show-all") flags+=("--show-all")
flags+=("-a") flags+=("-a")
flags+=("--show-labels") flags+=("--show-labels")
flags+=("--sort-by=") flags+=("--sort-by=")
flags+=("--template=") flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t") two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--validate") flags+=("--validate")
flags+=("--alsologtostderr") flags+=("--alsologtostderr")
flags+=("--api-version=") flags+=("--api-version=")
@ -553,12 +569,18 @@ _kubectl_create_secret_generic()
flags+=("--output-version=") flags+=("--output-version=")
flags+=("--save-config") flags+=("--save-config")
flags+=("--schema-cache-dir=") flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--show-all") flags+=("--show-all")
flags+=("-a") flags+=("-a")
flags+=("--show-labels") flags+=("--show-labels")
flags+=("--sort-by=") flags+=("--sort-by=")
flags+=("--template=") flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t") two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--type=") flags+=("--type=")
flags+=("--validate") flags+=("--validate")
flags+=("--alsologtostderr") flags+=("--alsologtostderr")
@ -651,12 +673,18 @@ _kubectl_create_configmap()
flags+=("--output-version=") flags+=("--output-version=")
flags+=("--save-config") flags+=("--save-config")
flags+=("--schema-cache-dir=") flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--show-all") flags+=("--show-all")
flags+=("-a") flags+=("-a")
flags+=("--show-labels") flags+=("--show-labels")
flags+=("--sort-by=") flags+=("--sort-by=")
flags+=("--template=") flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t") two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--validate") flags+=("--validate")
flags+=("--alsologtostderr") flags+=("--alsologtostderr")
flags+=("--api-version=") flags+=("--api-version=")
@ -706,12 +734,18 @@ _kubectl_create_serviceaccount()
flags+=("--output-version=") flags+=("--output-version=")
flags+=("--save-config") flags+=("--save-config")
flags+=("--schema-cache-dir=") flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--show-all") flags+=("--show-all")
flags+=("-a") flags+=("-a")
flags+=("--show-labels") flags+=("--show-labels")
flags+=("--sort-by=") flags+=("--sort-by=")
flags+=("--template=") flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t") two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--validate") flags+=("--validate")
flags+=("--alsologtostderr") flags+=("--alsologtostderr")
flags+=("--api-version=") flags+=("--api-version=")
@ -770,6 +804,8 @@ _kubectl_create()
flags+=("-R") flags+=("-R")
flags+=("--save-config") flags+=("--save-config")
flags+=("--schema-cache-dir=") flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--validate") flags+=("--validate")
flags+=("--alsologtostderr") flags+=("--alsologtostderr")
flags+=("--api-version=") flags+=("--api-version=")
@ -829,6 +865,8 @@ _kubectl_replace()
flags+=("-R") flags+=("-R")
flags+=("--save-config") flags+=("--save-config")
flags+=("--schema-cache-dir=") flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--timeout=") flags+=("--timeout=")
flags+=("--validate") flags+=("--validate")
flags+=("--alsologtostderr") flags+=("--alsologtostderr")
@ -1077,6 +1115,8 @@ _kubectl_apply()
flags+=("--recursive") flags+=("--recursive")
flags+=("-R") flags+=("-R")
flags+=("--schema-cache-dir=") flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--validate") flags+=("--validate")
flags+=("--alsologtostderr") flags+=("--alsologtostderr")
flags+=("--api-version=") flags+=("--api-version=")
@ -1228,12 +1268,18 @@ _kubectl_rolling-update()
flags+=("--poll-interval=") flags+=("--poll-interval=")
flags+=("--rollback") flags+=("--rollback")
flags+=("--schema-cache-dir=") flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--show-all") flags+=("--show-all")
flags+=("-a") flags+=("-a")
flags+=("--show-labels") flags+=("--show-labels")
flags+=("--sort-by=") flags+=("--sort-by=")
flags+=("--template=") flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t") two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--timeout=") flags+=("--timeout=")
flags+=("--update-period=") flags+=("--update-period=")
flags+=("--validate") flags+=("--validate")
@ -1677,7 +1723,11 @@ _kubectl_run()
flags+=("--stdin") flags+=("--stdin")
flags+=("-i") flags+=("-i")
flags+=("--template=") flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t") two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--tty") flags+=("--tty")
flags+=("--alsologtostderr") flags+=("--alsologtostderr")
flags+=("--api-version=") flags+=("--api-version=")
@ -1753,7 +1803,11 @@ _kubectl_expose()
flags+=("--sort-by=") flags+=("--sort-by=")
flags+=("--target-port=") flags+=("--target-port=")
flags+=("--template=") flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t") two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--type=") flags+=("--type=")
flags+=("--alsologtostderr") flags+=("--alsologtostderr")
flags+=("--api-version=") flags+=("--api-version=")
@ -1820,7 +1874,11 @@ _kubectl_autoscale()
flags+=("--show-labels") flags+=("--show-labels")
flags+=("--sort-by=") flags+=("--sort-by=")
flags+=("--template=") flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t") two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--alsologtostderr") flags+=("--alsologtostderr")
flags+=("--api-version=") flags+=("--api-version=")
flags+=("--certificate-authority=") flags+=("--certificate-authority=")
@ -2119,7 +2177,11 @@ _kubectl_label()
flags+=("--show-labels") flags+=("--show-labels")
flags+=("--sort-by=") flags+=("--sort-by=")
flags+=("--template=") flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t") two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--alsologtostderr") flags+=("--alsologtostderr")
flags+=("--api-version=") flags+=("--api-version=")
flags+=("--certificate-authority=") flags+=("--certificate-authority=")
@ -2208,7 +2270,11 @@ _kubectl_annotate()
flags+=("--show-labels") flags+=("--show-labels")
flags+=("--sort-by=") flags+=("--sort-by=")
flags+=("--template=") flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t") two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--alsologtostderr") flags+=("--alsologtostderr")
flags+=("--api-version=") flags+=("--api-version=")
flags+=("--certificate-authority=") flags+=("--certificate-authority=")
@ -2261,7 +2327,11 @@ _kubectl_config_view()
flags+=("--show-labels") flags+=("--show-labels")
flags+=("--sort-by=") flags+=("--sort-by=")
flags+=("--template=") flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t") two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--alsologtostderr") flags+=("--alsologtostderr")
flags+=("--api-version=") flags+=("--api-version=")
flags+=("--certificate-authority=") flags+=("--certificate-authority=")
@ -2303,6 +2373,8 @@ _kubectl_config_set-cluster()
flags+=("--api-version=") flags+=("--api-version=")
flags+=("--certificate-authority=") flags+=("--certificate-authority=")
flags_with_completion+=("--certificate-authority")
flags_completion+=("_filedir")
flags+=("--embed-certs=") flags+=("--embed-certs=")
flags+=("--insecure-skip-tls-verify=") flags+=("--insecure-skip-tls-verify=")
flags+=("--server=") flags+=("--server=")
@ -2341,7 +2413,11 @@ _kubectl_config_set-credentials()
flags_completion=() flags_completion=()
flags+=("--client-certificate=") flags+=("--client-certificate=")
flags_with_completion+=("--client-certificate")
flags_completion+=("_filedir")
flags+=("--client-key=") flags+=("--client-key=")
flags_with_completion+=("--client-key")
flags_completion+=("_filedir")
flags+=("--embed-certs=") flags+=("--embed-certs=")
flags+=("--password=") flags+=("--password=")
flags+=("--token=") flags+=("--token=")
@ -2798,12 +2874,18 @@ _kubectl_convert()
flags+=("--recursive") flags+=("--recursive")
flags+=("-R") flags+=("-R")
flags+=("--schema-cache-dir=") flags+=("--schema-cache-dir=")
flags_with_completion+=("--schema-cache-dir")
flags_completion+=("_filedir")
flags+=("--show-all") flags+=("--show-all")
flags+=("-a") flags+=("-a")
flags+=("--show-labels") flags+=("--show-labels")
flags+=("--sort-by=") flags+=("--sort-by=")
flags+=("--template=") flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t") two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--validate") flags+=("--validate")
flags+=("--alsologtostderr") flags+=("--alsologtostderr")
flags+=("--api-version=") flags+=("--api-version=")

View File

@ -24,7 +24,7 @@ Specifying a name that already exists will merge new fields on top of existing v
.PP .PP
\fB\-\-certificate\-authority\fP="" \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 .PP
\fB\-\-embed\-certs\fP=false \fB\-\-embed\-certs\fP=false

View File

@ -35,11 +35,11 @@ Bearer token and basic auth are mutually exclusive.
.SH OPTIONS .SH OPTIONS
.PP .PP
\fB\-\-client\-certificate\fP="" \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 .PP
\fB\-\-client\-key\fP="" \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 .PP
\fB\-\-embed\-certs\fP=false \fB\-\-embed\-certs\fP=false

View File

@ -63,7 +63,7 @@ kubectl config set-cluster e2e --insecure-skip-tls-verify=true
``` ```
--api-version="": api-version for the cluster entry in kubeconfig --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 --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 --insecure-skip-tls-verify[=false]: insecure-skip-tls-verify for the cluster entry in kubeconfig
--server="": server for the cluster entry in kubeconfig --server="": server for the cluster entry in kubeconfig
@ -97,7 +97,7 @@ kubectl config set-cluster e2e --insecure-skip-tls-verify=true
* [kubectl config](kubectl_config.md) - config modifies kubeconfig files * [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 --> <!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_set-cluster.md?pixel)]() [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_set-cluster.md?pixel)]()

View File

@ -75,8 +75,8 @@ kubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.
### Options ### Options
``` ```
--client-certificate="": path to client-certificate 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 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 --embed-certs[=false]: embed client cert/key for the user entry in kubeconfig
--password="": password for the user entry in kubeconfig --password="": password for the user entry in kubeconfig
--token="": token for the user entry in kubeconfig --token="": token for the user entry in kubeconfig
@ -109,7 +109,7 @@ kubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.
* [kubectl config](kubectl_config.md) - config modifies kubeconfig files * [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 --> <!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_set-credentials.md?pixel)]() [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_config_set-credentials.md?pixel)]()

View File

@ -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.clientCertificate, clientcmd.FlagCertFile, "path to "+clientcmd.FlagCertFile+" file for the user entry in kubeconfig")
cmd.Flags().Var(&options.clientKey, clientcmd.FlagKeyFile, "path to "+clientcmd.FlagKeyFile+" 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.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.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") cmd.Flags().Var(&options.password, clientcmd.FlagPassword, clientcmd.FlagPassword+" for the user entry in kubeconfig")

View File

@ -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") 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 := cmd.Flags().VarPF(&options.insecureSkipTLSVerify, clientcmd.FlagInsecure, "", clientcmd.FlagInsecure+" for the cluster entry in kubeconfig")
f.NoOptDefVal = "true" 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 = cmd.Flags().VarPF(&options.embedCAData, clientcmd.FlagEmbedCerts, "", clientcmd.FlagEmbedCerts+" for the cluster entry in kubeconfig")
f.NoOptDefVal = "true" f.NoOptDefVal = "true"

View File

@ -331,6 +331,7 @@ func GetFlagDuration(cmd *cobra.Command, flag string) time.Duration {
func AddValidateFlags(cmd *cobra.Command) { func AddValidateFlags(cmd *cobra.Command) {
cmd.Flags().Bool("validate", true, "If true, use a schema to validate the input before sending it") 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.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) { func AddRecursiveFlag(cmd *cobra.Command, value *bool) {

View File

@ -37,6 +37,7 @@ func AddPrinterFlags(cmd *cobra.Command) {
// template shorthand -t is deprecated to support -t for --tty // template shorthand -t is deprecated to support -t for --tty
// TODO: remove template flag shorthand -t // 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.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().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().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.)") cmd.Flags().BoolP("show-all", "a", false, "When printing, show all resources (default hide terminated pods.)")