Add a better message if the user doesn't specify a resource type.

This commit is contained in:
Brendan Burns 2015-06-09 15:04:56 -07:00
parent 6a979704b7
commit b259c873b7

View File

@ -17,6 +17,7 @@ limitations under the License.
package cmd
import (
"errors"
"fmt"
"io"
@ -94,6 +95,23 @@ func RunGet(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string
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
isWatch, isWatchOnly := cmdutil.GetFlagBool(cmd, "watch"), cmdutil.GetFlagBool(cmd, "watch-only")
if isWatch || isWatchOnly {