Comment by jen20
6 years ago
Absolutely - I can't buy into the "don't write man pages" idea.
For many years I've had this function in my RC files for macOS:
pman() { man -t "$@" | open -f -a Preview; }
It opens the given man page in Preview, typeset beautifully. No such thing is available for random text printed to the console, nor is a console pager (as recommended by this article) an acceptable substitute for this.
What a fantastic tip. Thanks for sharing!
For those on Linux you can do this with:
f=$(mktemp);man -t "$@" > "$f" && ( {some-pdf-viewer} "$f" ; rm "$f" )
... replacing '{some-pdf-viewer}' with whatever PDF viewer works for you. There is probably one that will take the document on stdin, but I am not aware of one.
I realize I'm late to the party here, but thought is was worth posting anyway. (edited for typo)
With BSD man (default on Void Linux) you can do:
MANPAGER=<some-pdf-viewer> man -T pdf <command>
You should be able to avoid using mktemp by:
pman='some-pdf-viewer <(man -t "$@")'
Apparently not possible for PDFs, see https://superuser.com/questions/1243405/using-process-substi... . TIL
What a good idea! Thanks for this, added to my aliases.
What is Preview?
Mac OS's built-in PDF viewer, which also views images and—relevant here—Postscript files.
Thank you for sharing this tip!