mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 20:17:41 +00:00
Merge pull request #9522 from brendandburns/friction
Add a better message if the user doesn't specify a resource type.
This commit is contained in:
commit
72082624e5
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
@ -94,6 +95,23 @@ func RunGet(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(args) == 0 {
|
||||||
|
fmt.Fprint(out, `
|
||||||
|
You must specify the type of resource to get. Valid resource types include:
|
||||||
|
* pods (aka 'po')
|
||||||
|
* replicationcontrollers (aka 'rc')
|
||||||
|
* services
|
||||||
|
* nodes (aka 'no')
|
||||||
|
* events (aka 'ev')
|
||||||
|
* secrets
|
||||||
|
* limits
|
||||||
|
* persistentVolumes (aka 'pv')
|
||||||
|
* persistentVolumeClaims (aka 'pvc')
|
||||||
|
* quota
|
||||||
|
`)
|
||||||
|
return errors.New("Required resource not specified.")
|
||||||
|
}
|
||||||
|
|
||||||
// handle watch separately since we cannot watch multiple resource types
|
// handle watch separately since we cannot watch multiple resource types
|
||||||
isWatch, isWatchOnly := cmdutil.GetFlagBool(cmd, "watch"), cmdutil.GetFlagBool(cmd, "watch-only")
|
isWatch, isWatchOnly := cmdutil.GetFlagBool(cmd, "watch"), cmdutil.GetFlagBool(cmd, "watch-only")
|
||||||
if isWatch || isWatchOnly {
|
if isWatch || isWatchOnly {
|
||||||
|
Loading…
Reference in New Issue
Block a user