For me, it’s hard to quickly parse and understand messy output from commands that line wraps (text spans multiple lines), this prevents me from just easily scanning the printed output. Most snap commands are short, and my terminals are usually not the standard 80 (like in the screenshots) but for example
snap find is still a problem on my 142 char wide terminal.
Most classic applications (like
ps) shortens, or removes output when there is limited space, for readability. This is of course only done in an interactive terminal (so it will not interfere with scripts). It’s also common to provide a parameter to turn this off.
I provided a short screenshot demonstration, with a simple function that just cut’s the lines down to $COLUMN:
if [ $1 == find -o $1 == search -o $1 == list ]; then
/usr/bin/snap $@ | cut -c -$COLUMNS;
The below example is much easier to read. Sure we do of course now have a problem that most of the summary is cut, people need to resize the terminal and run the command again to see more. The first four columns in the modified example is still readable, but the right output is unreadable and I need to resize the terminal just to read the 1st column.
List has the same problem, less of a problem for me personalty with 100+ char wide terminals.
What is your thoughts about this? Just to cut down the lines are or course a “quick fix”, a better solution would to add a little logic to the output… possible something like this:
This has been a frustration I have had with the snap command line tool for months. Thanks for raising it. Perhaps we can use similar methods to our friends in apt-cache and apt.
The latter with some colour I find nicely readable.
That’s an idea, made an example so see how that would look.
I did a few tweaks:
- Added a space around the
/ separator, this makes it easier to copy-paste the name by double clicking the world. These is one of the small annoyances that I have with apt
- There was no point to show an empty note, so I removed it. If there is an note the idea is to add it under developer with
- I removed the text
Summary, I think it’s obvious that the text is an summary… but now when I think about it this is probably a bad idea, what if someone makes a summary to be
Security: Verified or something
I implemented a smarter, width-aware layout for
snap list and
snap find a couple of times already, and it got shot down due to emerging hard requirements:
- each result must be entirely in a single line, for
- you can’t detect stdout to a tty and use a different layout algorithm as that impacts discoverability of (1).
- you can’t output the header periodically (a la
vmstat) to limit the impact of long widths on the overall list, as that is Just Weird.
I created the snap
interdenominational-counterintelligences when playing with this; it uses the maximum allowed width of the fields. You can even install it locally,
snap install --channel=stable/it-was-the-best-of-times--it-was-the-worst-of-times--it-was-the-age-of-wisdom--it-was-the-age-of-foolishness interdenominational-counterintelligences
I’ve asked for design input, or just a clear and total list of requirements, before delving into looking at this issue again. That was before the Budapest sprint.