~emersion/hut#16: 
Align output fields

Instead of

#29049 proposed todo: Add ticket comment (<a href="/~xenrox">~xenrox</a> 4 days ago)
#29037 applied todo: Handle owner in getTrackerID (<a href="/~xenrox">~xenrox</a> 5 days ago)
#29027 applied lists patchset: Implement patch ID completion v2 (<a href="/~xenrox">~xenrox</a> 5 days ago)

we could print aligned fields:

#29049 proposed todo: Add ticket comment                         (<a href="/~xenrox">~xenrox</a> 4 days ago)
#29037 applied  todo: Handle owner in getTrackerID               (<a href="/~xenrox">~xenrox</a> 5 days ago)
#29027 applied  lists patchset: Implement patch ID completion v2 (<a href="/~xenrox">~xenrox</a> 5 days ago)

Need to figure out what to do with very long field entries.

Status
REPORTED
Submitter
~emersion
Assigned to
No-one
Submitted
4 months ago
Updated
3 months ago
Labels
enhancement

~emersion 3 months ago

Thorben Günther referenced this ticket in commit 9c42e4c.

~xenrox 3 months ago

I wanted to align hut todo ticket list output and noticed one problem:

tabwriter does not handle coloured output very well. It counts the length of the formatting string as if it were displayed in the terminal. I worked around it by making all format strings the same length and while that worked for hut lists patchset list, we have a varying amount of coloured labels for each ticket. Right now I see 2-3 options how we could handle this:

  1. Iterate over all tickets, check which one has the most labels and pad the rest with with "invisible" formatting strings
  2. Put labels towards the end of the output
  3. Fork tabwriter and adjust the code as necessary (it is frozen)

~emersion 3 months ago

Maybe we can use an alternate tabwriter package? e.g. github.com/juju/ansiterm/tabwriter sounds like it should handle ANSI escapes properly?

~xenrox 3 months ago

Indeed that looks good and seems to fix my problem.

Register here or Log in to comment, or comment via email.