Limiting number of search results

I’d like to move from snap find's current “show as much as can be gotten from the store in a single result” to a slightly less verbose “show up to a screenfull of results”, which could be overridden with --lines=all (the default behaviour being --lines=auto, with --lines=<N> being supported as well).
The response from the store is sorted by relevancy, so the last items returned are the least likely to be what the user wanted, and yet they’re the only ones a user will see.

@chipaca I like the proposal and since we currently present one result (snap) per line --line=<N> could correspond directly to search?size=<N> API request (default size is 100, currently)

Could this potentially be applied to snap list as well (or maybe all snap commands which potentially have long outputs) and maybe done as a pages system with Ctrl + C exit like a man page?

Just floating an idea, it might be terrible, it would be many more keypresses to use, the current system is 0 keypresses, so perhaps John’s original idea is better.

@niemeyer I’d like to get this cleared to go, so I can implement it when I have a bit of downtime.

All that’s missing is a +1, and maybe confirmation that --lines is the right flag (vs --max-lines, --limit, --count, --size, or -n).

Talked about this during the standup. I’m going to JFDI and then ensure I get final approval before it reaches stable.

Having a flag sounds okay, but limiting results to a screen sounds a bit strange. Scrolling is a thing, and is fairly popular in graphic terminals. I’d rather get all results and scroll than have to type something like --lines=all all the time.

The flag name --lines also doesn’t sound so great because we have a header, so the output may be unexpected depending on how you interpret it (off by one).

Other than that, having the flag to restrict the output, instead of opening it up, sounds fine. We already have the -n flag on logs, and it’s also the one used in tail, so perhaps not so bad. It’s a pretty privileged flag name, but perhaps it should be given most things that list might want something along those lines.