FS#37818 - Pipe pacman's output into a pager

Attached to Project: Pacman
Opened by Lukas B (teateawhy) - Monday, 18 November 2013, 12:15 GMT
Task Type Bug Report
Category Output
Status Unconfirmed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version 4.1.2
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No

Details

Some pacman operations produce long output, which is usually longer than your terminal size. You have to scroll back to the beginning to read what you wanted. I suggest to fix this by piping the output into a pager like 'less', when required. Pacman should behave similar to 'git diff master'.
The pager should only be used if:
* 'Pager = /usr/bin/less' is configured in pacman.conf
* no user interaction is required in the operation ( or --noconfirm is used )
* pacman is run from an interactive shell ( AFAIK pacman can already detect this.)
* the number of output lines is larger than the number of terminal lines
* pacman's output is not piped into another command or redirected to a file

I think of operations like '-Q', '-Qet', and '-Ss', that become a lot more readable when piped into less.
This task depends upon

Comment by Karol Błażewicz (karol) - Monday, 18 November 2013, 12:32 GMT
Why not use an alias / function for that?
$ type qil
qil is a function
qil ()
{
pacman -Qi "$@" | less
}
Comment by Lukas B (teateawhy) - Monday, 18 November 2013, 13:13 GMT
Your suggestion is a workaround, but it does not solve this completely.
When the output is short enough to fit into the terminal, your function still uses a pager. Also it requires a seperate function for -Ss and -Q.
I am lazy and do not want to use different functions for the purpose of using pacman.
I would rather see this fixed in pacman, so that others benefit from it , too.
Comment by Dan McGee (toofishes) - Monday, 18 November 2013, 14:15 GMT
I am lazy and don't want to spend time implementing this, nor would I consider this a bug. Auto-pager is good for things that have potentially infinite length, such as logs. Not so much for output that my terminal scrollback can easily capture.

Maybe you should take a bit of time to read the less manpage and note the presence of the -F or --quit-if-one-screen options.
Comment by Allan McRae (Allan) - Monday, 18 November 2013, 14:39 GMT

Loading...