Add a better help message for kubectl describe

When resource type isn't given in the command, print the possible
resource types. Also added the resource type description in help
strings.
This commit is contained in:
hurf
2015-07-07 11:14:28 +08:00
parent c6161824db
commit 6dd8a1dfa4
5 changed files with 39 additions and 24 deletions

View File

@@ -17,7 +17,6 @@ limitations under the License.
package cmd
import (
"errors"
"fmt"
"io"
@@ -101,25 +100,8 @@ func RunGet(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string
}
if len(args) == 0 {
fmt.Fprint(out, `
You must specify the type of resource to get. Valid resource types include:
* componentStatuses (aka 'cs')
* endpoints (aka 'ep')
* events (aka 'ev')
* limits
* namespaces
* nodes (aka 'no')
* persistentVolumeClaims (aka 'pvc')
* persistentVolumes (aka 'pv')
* pods (aka 'po')
* podTemplates
* quota
* replicationcontrollers (aka 'rc')
* secrets
* serviceAccounts
* services
`)
return errors.New("Required resource not specified.")
fmt.Fprint(out, "You must specify the type of resource to get. ", valid_resources)
return cmdutil.UsageError(cmd, "Required resource not specified.")
}
// handle watch separately since we cannot watch multiple resource types