Merge pull request #24365 from janetkuo/remove-t-for-tty

Automatic merge from submit-queue

Add flag -t as shorthand for --tty

`-t` was deprecated in #12813 (Aug. 2015, about 6+ months ago). 

Now remove `--template`'s shorthand `-t` and create a shorthand `-t` for `--tty` in `kubectl run`. 

@kubernetes/kubectl
This commit is contained in:
k8s-merge-robot 2016-04-28 00:23:11 -07:00
commit ae5065a2c2
6 changed files with 14 additions and 58 deletions

View File

@ -371,9 +371,6 @@ _kubectl_get()
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")
@ -617,9 +614,6 @@ _kubectl_create_namespace()
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=")
@ -686,9 +680,6 @@ _kubectl_create_secret_docker-registry()
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=")
@ -755,9 +746,6 @@ _kubectl_create_secret_generic()
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")
@ -867,9 +855,6 @@ _kubectl_create_configmap()
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=")
@ -932,9 +917,6 @@ _kubectl_create_serviceaccount()
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=")
@ -1685,9 +1667,6 @@ _kubectl_rolling-update()
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")
@ -2169,10 +2148,8 @@ _kubectl_run()
flags+=("--template=")
flags_with_completion+=("--template")
flags_completion+=("_filedir")
two_word_flags+=("-t")
flags_with_completion+=("-t")
flags_completion+=("_filedir")
flags+=("--tty")
flags+=("-t")
flags+=("--alsologtostderr")
flags+=("--api-version=")
flags+=("--as=")
@ -2253,9 +2230,6 @@ _kubectl_expose()
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=")
@ -2342,9 +2316,6 @@ _kubectl_autoscale()
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+=("--as=")
@ -2669,9 +2640,6 @@ _kubectl_label()
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+=("--as=")
@ -2810,9 +2778,6 @@ _kubectl_annotate()
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+=("--as=")
@ -2906,9 +2871,6 @@ _kubectl_config_view()
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+=("--as=")
@ -3511,9 +3473,6 @@ _kubectl_convert()
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=")

View File

@ -142,8 +142,8 @@ Creates a deployment or job to manage the created container(s).
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]].
.PP
\fB\-\-tty\fP=false
Allocated a TTY for each container in the pod. Because \-t is currently shorthand for \-\-template, \-t is not supported for \-\-tty. This shorthand is deprecated and we expect to adopt \-t for \-\-tty soon.
\fB\-t\fP, \fB\-\-tty\fP=false
Allocated a TTY for each container in the pod.
.SH OPTIONS INHERITED FROM PARENT COMMANDS
@ -268,7 +268,7 @@ kubectl run nginx \-\-image=nginx \-\-dry\-run
kubectl run nginx \-\-image=nginx \-\-overrides='{ "apiVersion": "v1", "spec": { ... } }'
# Start a single instance of busybox and keep it in the foreground, don't restart it if it exits.
kubectl run \-i \-\-tty busybox \-\-image=busybox \-\-restart=Never
kubectl run \-i \-t busybox \-\-image=busybox \-\-restart=Never
# Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command.
kubectl run nginx \-\-image=nginx \-\- <arg1> <arg2> ... <argN>

View File

@ -68,7 +68,7 @@ kubectl run nginx --image=nginx --dry-run
kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
# Start a single instance of busybox and keep it in the foreground, don't restart it if it exits.
kubectl run -i --tty busybox --image=busybox --restart=Never
kubectl run -i -t busybox --image=busybox --restart=Never
# Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command.
kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>
@ -113,7 +113,7 @@ kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print
--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.
-i, --stdin[=false]: Keep stdin open on the container(s) in the pod, even if nothing is attached.
--template="": 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].
--tty[=false]: Allocated a TTY for each container in the pod. Because -t is currently shorthand for --template, -t is not supported for --tty. This shorthand is deprecated and we expect to adopt -t for --tty soon.
-t, --tty[=false]: Allocated a TTY for each container in the pod.
```
### Options inherited from parent commands
@ -148,7 +148,7 @@ kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra on 5-Apr-2016
###### Auto generated by spf13/cobra on 15-Apr-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_run.md?pixel)]()

View File

@ -114,9 +114,9 @@ options:
usage: |
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].
- name: tty
shorthand: t
default_value: "false"
usage: |
Allocated a TTY for each container in the pod. Because -t is currently shorthand for --template, -t is not supported for --tty. This shorthand is deprecated and we expect to adopt -t for --tty soon.
usage: Allocated a TTY for each container in the pod.
inherited_options:
- name: alsologtostderr
default_value: "false"
@ -198,7 +198,7 @@ example: |-
kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
# Start a single instance of busybox and keep it in the foreground, don't restart it if it exits.
kubectl run -i --tty busybox --image=busybox --restart=Never
kubectl run -i -t busybox --image=busybox --restart=Never
# Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command.
kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>

View File

@ -57,7 +57,7 @@ kubectl run nginx --image=nginx --dry-run
kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
# Start a single instance of busybox and keep it in the foreground, don't restart it if it exits.
kubectl run -i --tty busybox --image=busybox --restart=Never
kubectl run -i -t busybox --image=busybox --restart=Never
# Start the nginx container using the default command, but use custom arguments (arg1 .. argN) for that command.
kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>
@ -104,7 +104,7 @@ func addRunFlags(cmd *cobra.Command) {
cmd.Flags().Int("hostport", -1, "The host port mapping for the container port. To demonstrate a single-machine container.")
cmd.Flags().StringP("labels", "l", "", "Labels to apply to the pod(s).")
cmd.Flags().BoolP("stdin", "i", false, "Keep stdin open on the container(s) in the pod, even if nothing is attached.")
cmd.Flags().Bool("tty", false, "Allocated a TTY for each container in the pod. Because -t is currently shorthand for --template, -t is not supported for --tty. This shorthand is deprecated and we expect to adopt -t for --tty soon.")
cmd.Flags().BoolP("tty", "t", false, "Allocated a TTY for each container in the pod.")
cmd.Flags().Bool("attach", false, "If true, wait for the Pod to start running, and then attach to the Pod as if 'kubectl attach ...' were called. Default false, unless '-i/--interactive' is set, in which case the default is true.")
cmd.Flags().Bool("leave-stdin-open", false, "If the pod is started in interactive mode or with stdin, leave stdin open after the first attach completes. By default, stdin will be closed after the first attach completes.")
cmd.Flags().String("restart", "Always", "The restart policy for this Pod. Legal values [Always, OnFailure, Never]. If set to 'Always' a deployment is created for this pod, if set to OnFailure or Never, a job is created for this pod and --replicas must be 1. Default 'Always'")
@ -129,7 +129,7 @@ func Run(f *cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cob
interactive := cmdutil.GetFlagBool(cmd, "stdin")
tty := cmdutil.GetFlagBool(cmd, "tty")
if tty && !interactive {
return cmdutil.UsageError(cmd, "-i/--stdin is required for containers with --tty=true")
return cmdutil.UsageError(cmd, "-i/--stdin is required for containers with -t/--tty=true")
}
replicas := cmdutil.GetFlagInt(cmd, "replicas")
if interactive && replicas != 1 {

View File

@ -34,11 +34,8 @@ func AddPrinterFlags(cmd *cobra.Command) {
cmd.Flags().String("output-version", "", "Output the formatted object with the given group version (for ex: 'extensions/v1beta1').")
cmd.Flags().Bool("no-headers", false, "When using the default output, don't print headers.")
cmd.Flags().Bool("show-labels", false, "When printing, show all labels as the last column (default hide labels column)")
// 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.Flags().String("template", "", "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.)")
}