dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | README | LICENSE

commit c42fadd3d445734ffe09ffd790d985b6c03159d7 (patch)
parent 0ca53be167a7c5d711b668074501b43362848460
Author: Alex Karle <alex@alexkarle.com>
Date:   Sat,  3 Sep 2022 11:08:42 -0400

acme: Add `wiseman` command to bridge plan9 and unix manuals

I've found that /usr/bin/man doesn't render plan9 man pages quite right,
so this command is a middleman (hm that might have been a better name)
to see if it can find the man page in plan9 first.

Diffstat:
Abin/wiseman | 19+++++++++++++++++++
Mlib/plumbing | 4++--
2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/bin/wiseman b/bin/wiseman @@ -0,0 +1,19 @@ +#!/bin/sh +# wiseman -- for the plumber, use the correct man for plan9 vs unix +set -e +die() { + echo "$*" 1>&2 + exit 1 +} + +[ -z "$1" ] && die "usage: wiseman SECTION NAME" +[ -z "$2" ] && die "usage: wiseman SECTION NAME" + +section="$1" +page="$2" + +if [ -e "$PLAN9/man/man$section/$page.$section" ]; then + 9 man "$section" "$page" +else + /usr/bin/man "$section" "$page" +fi diff --git a/lib/plumbing b/lib/plumbing @@ -26,10 +26,10 @@ data matches '([a-zA-Z0-9_\-./]+)\.(pdf|PDF)' arg isfile $0 plumb start chromium $file -# man pages use system man (but searches plan9 too!) +# man pages use wiseman to support both system and plan9 roff formats type is text data matches '([a-zA-Z¡-￿0-9_\-./]+)\(([1-8])\)' -plumb start rc -c '/usr/bin/man -m /usr/lib/plan9/man '$2' '$1' >[2=1] | nobs | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')''' +plumb start rc -c 'wiseman '$2' '$1' >[2=1] | nobs | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')''' # sha1's to git type is text