Skip to content

oc help output improvements #12724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/man/man1/oc-scale.1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Scale also allows users to specify one or more preconditions for the scale actio
.PP
Note that scaling a deployment configuration with no deployments will update the desired replicas in the configuration template.

.PP
Supported resources: ["deployment" "replicaset" "replicationcontroller" "job" "deploymentconfig"]


.SH OPTIONS
.PP
Expand Down
3 changes: 3 additions & 0 deletions docs/man/man1/openshift-cli-scale.1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Scale also allows users to specify one or more preconditions for the scale actio
.PP
Note that scaling a deployment configuration with no deployments will update the desired replicas in the configuration template.

.PP
Supported resources: ["deployment" "replicaset" "replicationcontroller" "job" "deploymentconfig"]


.SH OPTIONS
.PP
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/cli/cmd/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var (
// NewCmdProcess implements the OpenShift cli process command
func NewCmdProcess(fullName string, f *clientcmd.Factory, in io.Reader, out, errout io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "process (TEMPLATE | -f FILENAME) [-v=KEY=VALUE]",
Use: "process (TEMPLATE | -f FILENAME) [-p=KEY=VALUE]",
Short: "Process a template into list of resources",
Long: processLong,
Example: fmt.Sprintf(processExample, fullName),
Expand Down
9 changes: 6 additions & 3 deletions pkg/cmd/cli/cmd/wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,10 @@ var (
scale is sent to the server.

Note that scaling a deployment configuration with no deployments will update the
desired replicas in the configuration template.`)
desired replicas in the configuration template.

Supported resources:
%q`)

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

Expand Down
7 changes: 6 additions & 1 deletion pkg/cmd/cli/describe/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ func formatEnv(env api.EnvVar) string {
}

func formatString(out *tabwriter.Writer, label string, v interface{}) {
fmt.Fprintf(out, fmt.Sprintf("%s:\t%s\n", label, toString(v)))
labelVals := strings.Split(toString(v), "\n")

fmt.Fprintf(out, fmt.Sprintf("%s:", label))
for _, lval := range labelVals {
fmt.Fprintf(out, fmt.Sprintf("\t%s\n", lval))
}
}

func formatTime(out *tabwriter.Writer, label string, t time.Time) {
Expand Down
13 changes: 11 additions & 2 deletions pkg/generate/app/cmd/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ func TransformTemplate(tpl *templateapi.Template, client client.TemplateConfigsN
return result, nil
}

func formatString(out io.Writer, tab, s string) {
labelVals := strings.Split(s, "\n")

for _, lval := range labelVals {
fmt.Fprintf(out, fmt.Sprintf("%s%s\n", tab, lval))
}
}

// DescribeGeneratedTemplate writes a description of the provided template to out.
func DescribeGeneratedTemplate(out io.Writer, input string, result *templateapi.Template, baseNamespace string) {
qualifiedName := localOrRemoteName(result.ObjectMeta, baseNamespace)
Expand All @@ -64,13 +72,14 @@ func DescribeGeneratedTemplate(out io.Writer, input string, result *templateapi.
fmt.Fprintf(out, " %s\n", name)
fmt.Fprintf(out, " ---------\n")
if len(description) > 0 {
fmt.Fprintf(out, " %s\n", description)
formatString(out, " ", description)
fmt.Fprintln(out)
}
if len(message) > 0 {
fmt.Fprintf(out, " %s\n", message)
formatString(out, " ", message)
fmt.Fprintln(out)
}
fmt.Fprintln(out)
}

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