Merge pull request #123619 from Eduard-Voiculescu/warning-watch-only-msg
show warning message only when running `kubectl get --watch-only` Kubernetes-commit: f1385904eac7ca234f33e2b45d752c2013bfde4a
This commit is contained in:
		
						commit
						57112bd241
					
				| 
						 | 
				
			
			@ -267,9 +267,13 @@ func (o *GetOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []stri
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	switch {
 | 
			
		||||
	case o.Watch || o.WatchOnly:
 | 
			
		||||
	case o.Watch:
 | 
			
		||||
		if len(o.SortBy) > 0 {
 | 
			
		||||
			fmt.Fprintf(o.IOStreams.ErrOut, "warning: --watch or --watch-only requested, --sort-by will be ignored\n")
 | 
			
		||||
			fmt.Fprintf(o.IOStreams.ErrOut, "warning: --watch requested, --sort-by will be ignored for watch events received\n")
 | 
			
		||||
		}
 | 
			
		||||
	case o.WatchOnly:
 | 
			
		||||
		if len(o.SortBy) > 0 {
 | 
			
		||||
			fmt.Fprintf(o.IOStreams.ErrOut, "warning: --watch-only requested, --sort-by will be ignored\n")
 | 
			
		||||
		}
 | 
			
		||||
	default:
 | 
			
		||||
		if len(args) == 0 && cmdutil.IsFilenameSliceEmpty(o.Filenames, o.Kustomize) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue