-
Notifications
You must be signed in to change notification settings - Fork 782
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
Wrap terminal line output to 80 characters #646
Comments
Thanks for opening this issue. I think we should limit line lengths to 80 characters so they can fit on terminals of the traditional size. I'm usually working on a 15 inch screen or smaller, and like to have two terminals side by side, which means lines need to be less than 90-100 characters to not wrap. |
A bash utility that handled this and the column issue in #661 would be amazing. |
Wouldn't the util need to be aware of all of the indentation formats used by all of the commands in order to automatically wrap them? For example, the Or is there maybe an existing tool for generating tabular text content wrapped at 80 chars? |
@jsejcksn #742 should resolve the wrapping issue for the How do we feel about not necessarily a hard cap at 80 chars, but a solution that wraps by terminal width at the time of execution? Additionally, how do we feel about rendering multiple columns as alternating rows, eg: ➜ asdf plugin list --urls
PLUGIN URL
deno https://github.com/asdf-community/asdf-deno.git
firebase https://github.com/jthegedus/asdf-firebase.git
gcloud https://github.com/jthegedus/asdf-gcloud.git
golang https://github.com/kennyp/asdf-golang.git
gradle https://github.com/rfrancis/asdf-gradle.git
hadolint https://github.com/looztra/asdf-hadolint.git
java https://github.com/halcyon/asdf-java.git
maven https://github.com/halcyon/asdf-maven.git
nodejs https://github.com/asdf-vm/asdf-nodejs.git
ocaml https://github.com/asdf-community/asdf-ocaml.git
python https://github.com/danhper/asdf-python.git
shellcheck https://github.com/luizm/asdf-shellcheck.git
terraform https://github.com/Banno/asdf-hashicorp.git Becoming ➜ asdf plugin list --urls
PLUGIN
URL
deno
https://github.com/asdf-community/asdf-deno.git
firebase
https://github.com/jthegedus/asdf-firebase.git
gcloud
https://github.com/jthegedus/asdf-gcloud.git
golang
https://github.com/kennyp/asdf-golang.git
gradle
https://github.com/rfrancis/asdf-gradle.git
hadolint
https://github.com/looztra/asdf-hadolint.git
java
https://github.com/halcyon/asdf-java.git
maven
https://github.com/halcyon/asdf-maven.git
nodejs
https://github.com/asdf-vm/asdf-nodejs.git
ocaml
https://github.com/asdf-community/asdf-ocaml.git
python
https://github.com/danhper/asdf-python.git
shellcheck
https://github.com/luizm/asdf-shellcheck.git
terraform
https://github.com/Banno/asdf-hashicorp.git on terminals where the screen width is less than required for horizontal layout? |
If, by that, you mean a responsively-formatted output in which "it will wrap the contents to 80 chars if the terminal is 80 columns, or 90 chars if the terminal is 90 columns, etc." then I think that's a fantastic idea. I'm very curious how you plan to accomplish this if you are doing it in a POSIX-compliant way, and there are many projects which would benefit from such a formatter. Alternating rows:
I think that a consistently-formatted output might be important for parsers. I have used the output of various Finally, this makes me wonder: Is all of this data available in a machine-readable format somewhere? Or it is the responsibility of each plugin to source and correctly format the output of commands like |
Yes, that is the idea. It would not be an external package, just some more complex To be clear, I would like line wrapping to be mostly handled by the terminal. There's just times, like with the help text, where wrapping within a column is what is desired, not wrapping to the start of the next line as would happen with multiple columns where there's overflow. If the content can be wrapped in a better way without inline formatting, then (I think) we should. For instance, 80 cols is a standard width and is a fine starting point, but by wrapping at 80 our
I had not considered this. Good point. POSIX I will spend more time thinking on this as I do have ideas for outputs with more columns of information that would not be 80 col friendly by default, perhaps I could use a
Each plugin needs to follow specific output guidelines for each command and then the core 🆕 Another question while I am looking at the output formatting, some of our outputs have headings, some do not. I feel we should be consistent. What are peoples feelings on these differences:➜ asdf list
deno
1.0.0
1.0.5
firebase
8.4.1 Weird formatting. Should probably be either of: ➜ asdf list
PLUGIN VERSION
deno 1.0.0
1.0.5
firebase 8.4.1 or ➜ asdf list
deno
1.0.0
1.0.5
firebase
8.4.1 ➜ asdf list python
3.8.2 ➜ asdf plugin list
deno
firebase
python ➜ asdf plugin list --urls
deno https://github.com/asdf-community/asdf-deno.git
firebase https://github.com/jthegedus/asdf-firebase.git
python https://github.com/danhper/asdf-python.git Columnar data, no column titles. ➜ asdf plugin list --refs
deno master 3860217
firebase master fdab358
python master b544ac9 Columnar data, no column titles, last column isn't spaced consistently (just happen to align because all on ➜ asdf plugin list --refs --urls
deno https://github.com/asdf-community/asdf-deno.git master 3860217
firebase https://github.com/jthegedus/asdf-firebase.git master fdab358
python https://github.com/danhper/asdf-python.git master b544ac9 Columnar data, no column titles, third & fourth columns aren't spaced consistently. ➜ asdf plugin list all
1password https://github.com/samtgarson/asdf-1password.git
adr-tools https://gitlab.com/td7x/asdf/adr-tools.git
aks-engine https://github.com/robsonpeixoto/asdf-aks-engine.git
alp https://github.com/asdf-community/asdf-alp.git
... Columnar data, no column titles. ➜ asdf current
deno 1.0.0 (set by /home/jthegedus/.tool-versions)
version 8.0.2 is not installed for firebase
firebase
python 3.8.2 (set by /home/jthegedus/.tool-versions) Errors break rendering flow, see #528. Columnar data, no column titles. Any thoughts? While it would break some scripts and is annoying to trim, I prefer column titles. I also prefer titles everywhere instead of only sometimes. Spacing changes should be easily compatible if people are using Regex. Perhaps this should be another issue. |
I think headings are useful.
I don’t think that first example is weird. This example seems odd though:
Does |
EDITED below here: It doesn't require semver version strings. EG: java adopt-openjdk-11.0.6+10 (set by /home/jthegedus/.tool-versions) Good points again, thanks for you input.
For clarity, I meant column headings, not the weird list with indentation: PLUGIN VERSION
deno 1.0.0
deno 1.0.5
firebase 8.4.1 I've been saying weird, but I mean inconsistent. Cols with headings is explicit and better uses both horizontal and vertical space |
Ironically, GitHub comments are now capped at ~120 chars instead of 80 😉 |
Couple thoughts:
|
+1 for a machine-readable-formatted option using a flag. I suggest JSON. |
I also think that a flag to indicate output useful for scripting would be good. I do not like @jsejcksn what I've meant with machine-readable is that there's a standard, known format sent to stdout/stderr. That is, no headers, no forced wrapping of content. I don't think we'll be tackling outputting in JSON. If each row of data is predictably formatted, then simple Shell scripting tools like What I am thinking is this:
I'm leaning away from wrapping content within columns as I initially proposed. Thinking out loud, but perhaps in the default human-readable output we don't limit to 80 char and instead also introduce a flag for limiting to 80 char width. I say this because some of the command output we have is very difficult to limit to 80 chars. As an example, With Ultimately, I'm leaning more towards not truncating the data, letting the rows be as wide as they want, and then if provided a flag (or ASDF config value, or we detect Shell columns) we can use a different |
Does this mean something like TSV with variable-length whitespace instead of single tabs? JSON was just a suggestion, but if it's machine-readable I think adhering to any standard with a specification would be preferable to a consistent, arbitrary format. That way, no one has to write a new parser. |
Yes, TSV or space-delimited with variable-length whitespace. Again, my proposal is to make it essentially the same as the human readable without header rows and a known number of cols and separator. Though we could investigate a separate output just for machines along the lines of
Our goal here would be to align with existing shell applications that allow simple scripting and piping. I wouldn't put that in the same bucket as parsing nor As an example, here is what asdf-jthegedus on fix/update-all-plugins [?]
➜ git status
On branch fix/update-all-plugins
Your branch is up to date with 'origin/fix/update-all-plugins'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
test.txt
nothing added to commit but untracked files present (use "git add" to track)
asdf-jthegedus on fix/update-all-plugins [?]
➜ git status --porcelain
?? test.txt The output is intended to be machine-readable, but certainly not a data-interchange format like JSON |
Thanks for explaining; I understand better. Since there are two modes:
...is there any disadvantage to utilizing a standardized interchange format (like TSV, JSON, etc.) for the latter? |
I was leaning towards simple TSV for the |
Scannability would be improved greatly if lines were wrapped at 80 characters.
Here is example terminal output from the command
asdf help
. The longest unwrapped line is 125 characters:The text was updated successfully, but these errors were encountered: