What should Python apps do when asked to show help?

cs at zip.com.au cs at zip.com.au
Sun May 1 01:24:34 EDT 2016


On 30Apr2016 23:46, Random832 <random832 at fastmail.com> wrote:
>On Sat, Apr 30, 2016, at 22:30, Grant Edwards wrote:
>> We don't want to use a PAGER variable to specify when we want a pager
>> and when we don't want a pager.  If we want a pager we append "| less"
>> to the command.  If we don't want a pager, we don't append that to the
>> command.
>
>Setting PAGER=cat - permanently, in your profile, and never ever
>changing it - gives this result, yet it's described by some people here
>as "So I have to cripple my shell [...]?" What is crippled? Evidently
>you're not "we", since this "crippled" state of affairs seems to be a
>perfectly acceptable one to you.

This is an interesting argument.

Yes, PAGER=cat would make "man" also not page, and likely almost everything.  
And yet I am unwilling to do so. Why?

On reflection, my personal problems with this approach are twofold:

 - I want $PAGER to specify my preferred pager when I do want a pager, so 
   setting it to "cat" does not inform apps about my wishes

 - in an interactive shell, yes I can type "| less"; it seems painful (oh for 
   the happy days of yore when this was spelt "|pg":-)

I am going to try PAGER=cat as an experiment to seem how it feels. Now, I _do_ 
wish "man" to page for a number of reasons (a) my brain expects it (b) I like 
the nice colour highlighting of headings etc (c) manual pages and other 
_lengthy_ documents _are_ better paged than not. This last is in contrast to 
"help" messages, even lengthy usage messages: these are short enough that I 
feel they should not be paged, and if I come across a glaring exception i can 
always page them myself.

Fortunately for me, I am already in the position of mucking with "man"; my 
despite for GNU info with its weird non-paging browser and the accompanying GNU 
manual pages which all too frequently say "man is defunct, go look in info - we 
don't bother with man" drove me to rewrite "man" to try to suck in info files 
into flat pagable text. So telling my shell this:

  man(){ PAGER=less command man ${1+"$@"}; }

is no hardship.

I'll give this a go and see how it feels.

Cheers,
Cameron Simpson <cs at zip.com.au>



More information about the Python-list mailing list