On Thu, Aug 24, 2017 at 5:35 AM, Michael Lange <klappn...@freenet.de> wrote: > Hi Raju, > > On Thu, 24 Aug 2017 02:37:41 -0400 > kamaraju kusumanchi <raju.mailingli...@gmail.com> wrote: > > (...) >> The popsort.py utility is written by me. It can be downloaded from >> https://gitlab.com/d3k2mk7/rutils/blob/master/bin/popsort.py and is >> documented at >> http://raju.shoutwiki.com/wiki/Sort_output_of_apt-cache_search_by_popularity >> . >> I would appreciate if you have any feedback/comments/criticism on this >> script (no matter how small you think it is). > > very nice indeed, thanks for sharing!
You are welcome. > Only (very small) "criticism" (just because you were asking): I think the > output would be more "intuitive" to read if the most popular package > appears in the output first. I think adding a "sorted_lines.reverse()" in > sort_lines() just before the "return" statement would do that. But maybe > this is only my personal preference at all and other people like it > better the way it is. Thanks for the feedback. I added this under a new option, --most-popular-first. So, if you do % apt-cache search display manager --names-only | popsort.py --most-popular-first 1595 gdm3 - GNOME Display Manager 1999 lightdm - simple display manager 4337 sddm - modern display manager for X11 9363 xdm - X display manager 10218 slim - desktop-independent graphical login manager for X11 18484 lxdm - LXDE display manager 21307 wdm - WINGs Display Manager - an xdm replacement with a WindowMaker look 22060 nodm - automatic display manager it will list the most popular package first. However, I left the default as is. I prefer having the most popular package at the bottom as it minimizes "the eyeball movement". Consider, for example, a command that produces multiple pages of output such as % apt-cache search "^vim-" --names-only | popsort.py To look at a few of the famous packages in this, one has to either scroll up or pipe the output to head. With the current sorting method, you can keep eyes closer to the command line and still get all the important information. raju -- Kamaraju S Kusumanchi | http://raju.shoutwiki.com/wiki/Blog