diff --git a/contrib/completions/bash/kubectl b/contrib/completions/bash/kubectl index 08f18d5eb03..8e1a9ccc0cb 100644 --- a/contrib/completions/bash/kubectl +++ b/contrib/completions/bash/kubectl @@ -854,17 +854,8 @@ _kubectl_annotate() flags_completion+=("__handle_filename_extension_flag json|yaml|yml") flags+=("--help") flags+=("-h") - flags+=("--no-headers") - flags+=("--output=") - two_word_flags+=("-o") - flags+=("--output-version=") flags+=("--overwrite") flags+=("--resource-version=") - flags+=("--show-all") - flags+=("-a") - flags+=("--sort-by=") - flags+=("--template=") - two_word_flags+=("-t") must_have_one_flag=() must_have_one_noun=() diff --git a/docs/man/man1/kubectl-annotate.1 b/docs/man/man1/kubectl-annotate.1 index cdb7b51536c..6b2666c87bc 100644 --- a/docs/man/man1/kubectl-annotate.1 +++ b/docs/man/man1/kubectl-annotate.1 @@ -41,18 +41,6 @@ resourcequotas (quota) or secrets. \fB\-h\fP, \fB\-\-help\fP=false help for annotate -.PP -\fB\-\-no\-headers\fP=false - When using the default output, don't print headers. - -.PP -\fB\-o\fP, \fB\-\-output\fP="" - Output format. One of: json|yaml|template|templatefile|wide|jsonpath|name. - -.PP -\fB\-\-output\-version\fP="" - Output the formatted object with the given version (default api\-version). - .PP \fB\-\-overwrite\fP=false If true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite existing annotations. @@ -61,20 +49,6 @@ resourcequotas (quota) or secrets. \fB\-\-resource\-version\fP="" If non\-empty, the annotation update will only succeed if this is the current resource\-version for the object. Only valid when specifying a single resource. -.PP -\fB\-a\fP, \fB\-\-show\-all\fP=false - When printing, show all resources (default hide terminated pods.) - -.PP -\fB\-\-sort\-by\fP="" - If non\-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. 'ObjectMeta.Name'). The field in the API resource specified by this JSONPath expression must be an integer or a string. - -.PP -\fB\-t\fP, \fB\-\-template\fP="" - Template string or path to template file to use when \-o=template, \-o=templatefile or \-o=jsonpath. The template format is golang templates [ -\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]]. The jsonpath template is composed of jsonpath expressions enclosed by {} [ -\[la]http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md\[ra]] - .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP diff --git a/docs/user-guide/kubectl/kubectl_annotate.md b/docs/user-guide/kubectl/kubectl_annotate.md index a3889cef4ab..2b89739012a 100644 --- a/docs/user-guide/kubectl/kubectl_annotate.md +++ b/docs/user-guide/kubectl/kubectl_annotate.md @@ -84,14 +84,8 @@ $ kubectl annotate pods foo description- --all[=false]: select all resources in the namespace of the specified resource types -f, --filename=[]: Filename, directory, or URL to a file identifying the resource to update the annotation -h, --help[=false]: help for annotate - --no-headers[=false]: When using the default output, don't print headers. - -o, --output="": Output format. One of: json|yaml|template|templatefile|wide|jsonpath|name. - --output-version="": Output the formatted object with the given version (default api-version). --overwrite[=false]: If true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite existing annotations. --resource-version="": If non-empty, the annotation update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource. - -a, --show-all[=false]: When printing, show all resources (default hide terminated pods.) - --sort-by="": If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. 'ObjectMeta.Name'). The field in the API resource specified by this JSONPath expression must be an integer or a string. - --template="": Template string or path to template file to use when -o=template, -o=templatefile or -o=jsonpath. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. The jsonpath template is composed of jsonpath expressions enclosed by {} [http://releases.k8s.io/HEAD/docs/user-guide/jsonpath.md] ``` ### Options inherited from parent commands @@ -126,7 +120,7 @@ $ kubectl annotate pods foo description- * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-08-25 11:50:09.184436452 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-27 02:40:25.687121316 +0000 UTC [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_annotate.md?pixel)]() diff --git a/pkg/kubectl/cmd/annotation.go b/pkg/kubectl/cmd/annotate.go similarity index 98% rename from pkg/kubectl/cmd/annotation.go rename to pkg/kubectl/cmd/annotate.go index 866cb4aa3a2..45346ee5c7f 100644 --- a/pkg/kubectl/cmd/annotation.go +++ b/pkg/kubectl/cmd/annotate.go @@ -32,7 +32,6 @@ import ( // AnnotateOptions have the data required to perform the annotate operation type AnnotateOptions struct { - out io.Writer resources []string newAnnotations map[string]string removeAnnotations []string @@ -87,7 +86,7 @@ func NewCmdAnnotate(f *cmdutil.Factory, out io.Writer) *cobra.Command { Example: annotate_example, Run: func(cmd *cobra.Command, args []string) { options.filenames = cmdutil.GetFlagStringSlice(cmd, "filename") - if err := options.Complete(f, args, out); err != nil { + if err := options.Complete(f, args); err != nil { cmdutil.CheckErr(err) } if err := options.Validate(args); err != nil { @@ -98,7 +97,6 @@ func NewCmdAnnotate(f *cmdutil.Factory, out io.Writer) *cobra.Command { } }, } - cmdutil.AddPrinterFlags(cmd) cmd.Flags().BoolVar(&options.overwrite, "overwrite", false, "If true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite existing annotations.") cmd.Flags().BoolVar(&options.all, "all", false, "select all resources in the namespace of the specified resource types") cmd.Flags().StringVar(&options.resourceVersion, "resource-version", "", "If non-empty, the annotation update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource.") @@ -108,7 +106,7 @@ func NewCmdAnnotate(f *cmdutil.Factory, out io.Writer) *cobra.Command { } // Complete adapts from the command line args and factory to the data required. -func (o *AnnotateOptions) Complete(f *cmdutil.Factory, args []string, out io.Writer) (err error) { +func (o *AnnotateOptions) Complete(f *cmdutil.Factory, args []string) (err error) { namespace, enforceNamespace, err := f.DefaultNamespace() if err != nil { return err diff --git a/pkg/kubectl/cmd/annotation_test.go b/pkg/kubectl/cmd/annotate_test.go similarity index 97% rename from pkg/kubectl/cmd/annotation_test.go rename to pkg/kubectl/cmd/annotate_test.go index b5f9b693989..53c407c1d9e 100644 --- a/pkg/kubectl/cmd/annotation_test.go +++ b/pkg/kubectl/cmd/annotate_test.go @@ -401,7 +401,7 @@ func TestAnnotateErrors(t *testing.T) { cmd.Flags().Set(k, v) } options := &AnnotateOptions{} - err := options.Complete(f, testCase.args, buf) + err := options.Complete(f, testCase.args) if !testCase.errFn(err) { t.Errorf("%s: unexpected error: %v", k, err) continue @@ -448,11 +448,10 @@ func TestAnnotateObject(t *testing.T) { } tf.Namespace = "test" tf.ClientConfig = &client.Config{Version: testapi.Version()} - buf := bytes.NewBuffer([]byte{}) options := &AnnotateOptions{} args := []string{"pods/foo", "a=b", "c-"} - if err := options.Complete(f, args, buf); err != nil { + if err := options.Complete(f, args); err != nil { t.Fatalf("unexpected error: %v", err) } if err := options.Validate(args); err != nil { @@ -496,12 +495,11 @@ func TestAnnotateObjectFromFile(t *testing.T) { } tf.Namespace = "test" tf.ClientConfig = &client.Config{Version: testapi.Version()} - buf := bytes.NewBuffer([]byte{}) options := &AnnotateOptions{} options.filenames = []string{"../../../examples/cassandra/cassandra.yaml"} args := []string{"a=b", "c-"} - if err := options.Complete(f, args, buf); err != nil { + if err := options.Complete(f, args); err != nil { t.Fatalf("unexpected error: %v", err) } if err := options.Validate(args); err != nil { @@ -547,12 +545,11 @@ func TestAnnotateMultipleObjects(t *testing.T) { } tf.Namespace = "test" tf.ClientConfig = &client.Config{Version: testapi.Version()} - buf := bytes.NewBuffer([]byte{}) options := &AnnotateOptions{} options.all = true args := []string{"pods", "a=b", "c-"} - if err := options.Complete(f, args, buf); err != nil { + if err := options.Complete(f, args); err != nil { t.Fatalf("unexpected error: %v", err) } if err := options.Validate(args); err != nil {