Browse code

Merge pull request #10492 from juanvallejo/jvallejo_make-oc-idle-error-clearer

Merged by openshift-bot

OpenShift Bot authored on 2016/08/20 02:28:09
Showing 1 changed files
... ...
@@ -48,15 +48,16 @@ associated resources by scaling them back up to their previous scale.`
48 48
   $ %[1]s idle --resource-names-file to-idle.txt`
49 49
 )
50 50
 
51
-// NewCmdStatus implements the OpenShift cli status command
51
+// NewCmdIdle implements the OpenShift cli idle command
52 52
 func NewCmdIdle(fullName string, f *clientcmd.Factory, out, errOut io.Writer) *cobra.Command {
53 53
 	o := &IdleOptions{
54
-		out:    out,
55
-		errOut: errOut,
54
+		out:         out,
55
+		errOut:      errOut,
56
+		cmdFullName: fullName,
56 57
 	}
57 58
 
58 59
 	cmd := &cobra.Command{
59
-		Use:     "idle (SERVICES... | -l label | --all | --resource-names-file FILENAME)",
60
+		Use:     "idle (SERVICE_ENDPOINTS... | -l label | --all | --resource-names-file FILENAME)",
60 61
 		Short:   "Idle scalable resources",
61 62
 		Long:    idleLong,
62 63
 		Example: fmt.Sprintf(idleExample, fullName),
... ...
@@ -93,6 +94,8 @@ type IdleOptions struct {
93 93
 	allNamespaces bool
94 94
 	resources     string
95 95
 
96
+	cmdFullName string
97
+
96 98
 	nowTime    time.Time
97 99
 	svcBuilder *resource.Builder
98 100
 }
... ...
@@ -259,7 +262,7 @@ func (o *IdleOptions) calculateIdlableAnnotationsByService(f *clientcmd.Factory)
259 259
 
260 260
 		endpoints, isEndpoints := info.Object.(*api.Endpoints)
261 261
 		if !isEndpoints {
262
-			return fmt.Errorf("you must specify endpoints, not %vs", info.Mapping.Resource)
262
+			return fmt.Errorf("you must specify endpoints, not %v (view available endpoints with \"%s get endpoints\").", info.Mapping.Resource, o.cmdFullName)
263 263
 		}
264 264
 
265 265
 		endpointsName := types.NamespacedName{