Output of `git bug ls` doesn't fit in an 80-column terminal

Timeline

Juliusz Chroboczek (jech) opened

When using an 80-column terminal, the output of git bug ls wraps around. (termui works fine, thanks.)

Sascha (GlancingMind) commented

Hi @jech,

whats your expected behavior? Instead of wrapping around, would you rather like the text to be printed as is?

Juliusz Chroboczek (jech) commented

I'd like a more compact format that fits in 80 columns. There could be a -l flag for those who prefer the long format.

Sascha (GlancingMind) commented

I just got an idea, how this could be solved. I'll do some research and give it a try.

Sascha (GlancingMind) commented

I hacked something together. Image of the different ls terminal outputs The image shows 3 command outputs:

  1. Display the ending of a line with 80 characters (for reference).
  2. The default git-bug ls output.
  3. The compact git-bug ls output.

Note that the compact output, doesn't truncate the title with an ellipsis. So the title can still wrap when being to long. How do you like it? @jech

Juliusz Chroboczek (jech) commented

I'm not a big fan, since it uses up two lines per issue. I'd like a format similar to the current format, but more compact — less characters for the title, a more compact representation of the username, and no speech bubble icon in the right margin. I also think that the compact format should be the default, with a -l option for the extended format.

Sascha (GlancingMind) commented (edited)

Hi @jech,

I trimmed the whitespace to the bare minimum of 1 space and I removed the comment counter. Further I set the maximal displayed title length to 25 characters and the maximum number of labels to 4 ◼. The status flags could be shortened to 1 character o/c or some graphical icon (not exactly sure which one). Also I'm not sure if I should add a character limit to the displayed username.

Here is an image with following content:

  1. 80 character line limit
  2. Current default ls displayed output.
  3. New compact ls displayed output.
  4. ls -f plain output. In case you don't know about this option. :-)

Image of multiple displayed ls command outputs.

How do you like it?

PS: Regarding the -l flag. Using the -l as flag isn't possible with the current ls implementation, as -l is the flag to filter by labels. But the compact version could become the default one and the current default could be moved to something like -f tabular. But such a change has to be acknowledged by @MichaelMure.

Juliusz Chroboczek (jech) commented (edited)

This looks good. Suggestion, align the username as in the default format, but so it fits in 79 columns.

Sascha (GlancingMind) commented (edited)

Okey, the user name is aligned. The 79 column should never be reached. (max 7 chars for hash + 1 Space + max 5 chars Status + max 40 chars title + 1 Space + max 5 chars to display a label + 1 Space + max 15 chars for username = 75 chars.)

Image of multiple ls command outputs Image description:

  1. Compact output
  2. Default output
  3. 79 character limit

If this is fine, I will start a PR.

Juliusz Chroboczek (jech) commented

Looks very good to me, thanks a lot. I would like to most humbly request that this format should be the default, it is compact and informative.

Ltrlg (Ltrlg) commented

I would like to most humbly request that this format should be the default, it is compact and informative.

The best default would be to check the current terminal size and auto-select the one that fits best.

Michael Muré (MichaelMure) closed the bug