Skip to content
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

oc in windows: cli help wraps awkwardly in default windows console #5336

Closed
csrwng opened this issue Oct 22, 2015 · 8 comments
Closed

oc in windows: cli help wraps awkwardly in default windows console #5336

csrwng opened this issue Oct 22, 2015 · 8 comments
Assignees
Labels
area/usability component/cli help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/P3

Comments

@csrwng
Copy link
Contributor

csrwng commented Oct 22, 2015

Although you can change the layout of a windows console, the default is 80 chars wide. With this default, the help and examples for most oc cli commands wrap awkwardly (here's part of oc --help):

Developer and Administrator Client

This client exposes commands for managing your applications, as well as lower le
vel
tools to interact with each component of your system.

To create a new application, you can use the example app source. Login to your s
erver and then
run new-app:

  $ oc login
  $ oc new-app openshift/ruby-20-centos7~https://github.com/openshift/ruby-hello
-world.git

This will create an application based on the Docker image 'openshift/ruby-20-cen
tos7' that builds
the source code at 'github.com/openshift/ruby-hello-world.git'. A build will sta
rt automatically and
a deployment will start as soon as the build finishes.

Once your application is deployed, use the status, get, and describe commands to
 see more about
the created components:

  $ oc status
  $ oc describe deploymentconfig ruby-hello-world
  $ oc get pods

You'll be able to view the deployed application on the IP and port of the servic
e that new-app
created for you.
@csrwng
Copy link
Contributor Author

csrwng commented Oct 22, 2015

@fabianofranz @jwforres

@fabianofranz
Copy link
Member

@liggitt please tag and assign to me.

@liggitt liggitt added kind/bug Categorizes issue or PR as related to a bug. component/cli area/usability priority/P3 labels Oct 22, 2015
@fabianofranz fabianofranz added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label May 20, 2016
@mkumatag
Copy link
Member

mkumatag commented Sep 8, 2016

Was looking into this issue, help messages are created with raw string literals and printing even the newlines in it which doesn't really supports any escape chars in it.

So I'm wondering what is best solution here?

  • Do we need to convert these raw string literals to interpreted string literals
  • Or do we have any other solution which will allow us to have newline escape char?

@fabianofranz
Copy link
Member

fabianofranz commented Sep 8, 2016

Note that this doesn't happen only on Windows, it's just worse because the default wide is lower. But if you resize your terminal window on Linux to a smaller size, at some point it becomes reproducible.

I don't think we would move away from using raw string literals. We should just change how we build them. For example, in the default explain output of oc: we should have line breaks where they are really wanted like here, but not have it in paragraphs like here to limit the max width we want to use to display long chunks of text. Note that our flags descriptions already do that.

Paragraphs should just be a long string line without additional line breaks, and the terminal would be responsible to wrap it according to the windows size. If we still want to limit the max size to avoid really wide content if your terminal is very large, we should do it globally and dynamically with something that detects the usable screen width and is responsible for wrapping when char width is larger than the max. We did that in past for rhc, not sure if it's doable in Go.

@fabianofranz
Copy link
Member

For reference, here's how we did it in rhc

https://github.com/openshift/rhc/blob/master/lib/rhc/cli.rb#L16-L24

@fabianofranz
Copy link
Member

@juanvallejo FYI

@fabianofranz
Copy link
Member

Looks doable, there are a few strategies in Go:

https://rosettacode.org/wiki/Terminal_control/Dimensions#Go

@fabianofranz
Copy link
Member

Fixed in #10993

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/usability component/cli help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/P3
Projects
None yet
Development

No branches or pull requests

4 participants