oclif / core

Node.js Open CLI Framework. Built by Salesforce.

Home Page:https://oclif.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ux.table `maxWidth` column option

nickjm opened this issue · comments

Is your feature request related to a problem? Please describe.
I would like to display long web urls in a table, which is difficult to fit in any terminal width alongside other columns. I came up with a nice solution to embed the links using terminal escape characters, for example so that only the text "link" is displayed, but a user can click on it to go to the embedded URL. However ux.table still interprets the width according to how many characters are in the raw string, including all the escape sequence characters and the hidden URL href value.

Describe the solution you'd like
Implement a maxWidth option for columns.

Describe alternatives you've considered
Respect shell escape sequences in strings when calculating width.

Additional context
Add any other context or screenshots about the feature request here.

@nickjm Would you be up for submitting a PR with your solution?

I'm going to close this since we've decided to remove the ux module in the next major version. There are much better dedicated libraries for generating tables in the CLI that I recommend you use instead.