Skip to content

Commit c8e60fe

Browse files
author
OpenShift Bot
authored
Merge pull request #12724 from juanvallejo/jvallejo/oc-help-output-improvements
Merged by openshift-bot
2 parents c4879fc + 50f4843 commit c8e60fe

File tree

6 files changed

+30
-7
lines changed

6 files changed

+30
-7
lines changed

docs/man/man1/oc-scale.1

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ Scale also allows users to specify one or more preconditions for the scale actio
2121
.PP
2222
Note that scaling a deployment configuration with no deployments will update the desired replicas in the configuration template.
2323

24+
.PP
25+
Supported resources: ["deployment" "replicaset" "replicationcontroller" "job" "deploymentconfig"]
26+
2427

2528
.SH OPTIONS
2629
.PP

docs/man/man1/openshift-cli-scale.1

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ Scale also allows users to specify one or more preconditions for the scale actio
2121
.PP
2222
Note that scaling a deployment configuration with no deployments will update the desired replicas in the configuration template.
2323

24+
.PP
25+
Supported resources: ["deployment" "replicaset" "replicationcontroller" "job" "deploymentconfig"]
26+
2427

2528
.SH OPTIONS
2629
.PP

pkg/cmd/cli/cmd/process.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ var (
6161
// NewCmdProcess implements the OpenShift cli process command
6262
func NewCmdProcess(fullName string, f *clientcmd.Factory, in io.Reader, out, errout io.Writer) *cobra.Command {
6363
cmd := &cobra.Command{
64-
Use: "process (TEMPLATE | -f FILENAME) [-v=KEY=VALUE]",
64+
Use: "process (TEMPLATE | -f FILENAME) [-p=KEY=VALUE]",
6565
Short: "Process a template into list of resources",
6666
Long: processLong,
6767
Example: fmt.Sprintf(processExample, fullName),

pkg/cmd/cli/cmd/wrappers.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,10 @@ var (
341341
scale is sent to the server.
342342
343343
Note that scaling a deployment configuration with no deployments will update the
344-
desired replicas in the configuration template.`)
344+
desired replicas in the configuration template.
345+
346+
Supported resources:
347+
%q`)
345348

346349
scaleExample = templates.Examples(`
347350
# Scale replication controller named 'foo' to 3.
@@ -358,10 +361,10 @@ var (
358361
// NewCmdScale is a wrapper for the Kubernetes cli scale command
359362
func NewCmdScale(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
360363
cmd := kcmd.NewCmdScale(f, out)
364+
cmd.ValidArgs = append(cmd.ValidArgs, "deploymentconfig")
361365
cmd.Short = "Change the number of pods in a deployment"
362-
cmd.Long = scaleLong
366+
cmd.Long = fmt.Sprintf(scaleLong, cmd.ValidArgs)
363367
cmd.Example = fmt.Sprintf(scaleExample, fullName)
364-
cmd.ValidArgs = append(cmd.ValidArgs, "deploymentconfig")
365368
return cmd
366369
}
367370

pkg/cmd/cli/describe/helpers.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ func formatEnv(env api.EnvVar) string {
6565
}
6666

6767
func formatString(out *tabwriter.Writer, label string, v interface{}) {
68-
fmt.Fprintf(out, fmt.Sprintf("%s:\t%s\n", label, toString(v)))
68+
labelVals := strings.Split(toString(v), "\n")
69+
70+
fmt.Fprintf(out, fmt.Sprintf("%s:", label))
71+
for _, lval := range labelVals {
72+
fmt.Fprintf(out, fmt.Sprintf("\t%s\n", lval))
73+
}
6974
}
7075

7176
func formatTime(out *tabwriter.Writer, label string, t time.Time) {

pkg/generate/app/cmd/template.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ func TransformTemplate(tpl *templateapi.Template, client client.TemplateConfigsN
4545
return result, nil
4646
}
4747

48+
func formatString(out io.Writer, tab, s string) {
49+
labelVals := strings.Split(s, "\n")
50+
51+
for _, lval := range labelVals {
52+
fmt.Fprintf(out, fmt.Sprintf("%s%s\n", tab, lval))
53+
}
54+
}
55+
4856
// DescribeGeneratedTemplate writes a description of the provided template to out.
4957
func DescribeGeneratedTemplate(out io.Writer, input string, result *templateapi.Template, baseNamespace string) {
5058
qualifiedName := localOrRemoteName(result.ObjectMeta, baseNamespace)
@@ -64,13 +72,14 @@ func DescribeGeneratedTemplate(out io.Writer, input string, result *templateapi.
6472
fmt.Fprintf(out, " %s\n", name)
6573
fmt.Fprintf(out, " ---------\n")
6674
if len(description) > 0 {
67-
fmt.Fprintf(out, " %s\n", description)
75+
formatString(out, " ", description)
6876
fmt.Fprintln(out)
6977
}
7078
if len(message) > 0 {
71-
fmt.Fprintf(out, " %s\n", message)
79+
formatString(out, " ", message)
7280
fmt.Fprintln(out)
7381
}
82+
fmt.Fprintln(out)
7483
}
7584

7685
if warnings := result.Annotations[app.GenerationWarningAnnotation]; len(warnings) > 0 {

0 commit comments

Comments
 (0)