Comment 17 for bug 213718

Revision history for this message
Josh Triplett (joshtriplett) wrote :

A note regarding configuration, and handling this in a way that ensures people can easily turn it off: git looks at the environment variable $GIT_PAGER in preference to $PAGER, and also checks the configuration setting core.pager, as well as command-specific pager.(command) settings. This makes it easy to disable the pager for any or all commands, by setting one of these values to "cat". (git avoids spawning a separate process in this case, rather than actually feeding all output through cat.)

Similarly, I'd suggest that bzr could check $BZR_PAGER, the user's bzr configuration, and $PAGER, in that order. Anyone could then configure the pager behavior they prefer for bzr, which may differ from the pager behavior they prefer for other tools (such as "man").

That just leaves the question of the default: whether to automatically page long output by default, or only when explicitly configured.

I would suggest that the auto-pager behavior seems more friendly as a default, since it ensures that users can easily see the output they expected. Much like the "man" command, many bzr commands normally generate a large amount of output, and spawning a pager by default seems helpful for the same reasons, notably starting the user at the beginning with the ability to scroll down or search. It seems to me like that represents the right behavior to use for people who don't provide explicit configuration; I would propose that preferring to use terminal scrollback seems like the less common preference, and that people with that preference won't have any trouble setting the pager to "cat" either in bzr's configuration or the $BZR_PAGER environment variable.

Also, people who prefer to see the output in their terminal's scrollback may find less's -X option useful, which disables the terminal initialization that normally results in using the "alternate screen" in xterm-compatible terminals. Using that option will ensure that the output goes to your terminal's normal screen, and thus that you can see it with scrollback. bzr may want to set this and other options by default if not overridden; git sets LESS=FRSX if $LESS does not already have a value.