Skip to content

Commit f138590

Browse files
authored
Merge pull request kubernetes#123619 from Eduard-Voiculescu/warning-watch-only-msg
show warning message only when running `kubectl get --watch-only`
2 parents 48dbcf6 + a0aa7bf commit f138590

File tree

1 file changed

+6
-2
lines changed
  • staging/src/k8s.io/kubectl/pkg/cmd/get

1 file changed

+6
-2
lines changed

staging/src/k8s.io/kubectl/pkg/cmd/get/get.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,13 @@ func (o *GetOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []stri
267267
}
268268

269269
switch {
270-
case o.Watch || o.WatchOnly:
270+
case o.Watch:
271271
if len(o.SortBy) > 0 {
272-
fmt.Fprintf(o.IOStreams.ErrOut, "warning: --watch or --watch-only requested, --sort-by will be ignored\n")
272+
fmt.Fprintf(o.IOStreams.ErrOut, "warning: --watch requested, --sort-by will be ignored for watch events received\n")
273+
}
274+
case o.WatchOnly:
275+
if len(o.SortBy) > 0 {
276+
fmt.Fprintf(o.IOStreams.ErrOut, "warning: --watch-only requested, --sort-by will be ignored\n")
273277
}
274278
default:
275279
if len(args) == 0 && cmdutil.IsFilenameSliceEmpty(o.Filenames, o.Kustomize) {

0 commit comments

Comments
 (0)