fix for mandoc

This commit is contained in:
Rudis Muiznieks 2024-05-16 08:43:05 -05:00
parent a65c2e834a
commit 2d891a0851
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
2 changed files with 11 additions and 2 deletions

8
manbat Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
prg="$1"
shift
# mandoc passes a file name, other tools write to stdout
# using `cat "$@"` we take care of both reading from file and stdin
exec cat "$@" | col -bx | $prg --language man --style plain

View File

@ -1,3 +1,4 @@
BASEDIR=$(dirname "$0")
if command -v batcat >/dev/null 2>&1; then
# Save the original system `cat` under `rcat`
@ -6,12 +7,12 @@ if command -v batcat >/dev/null 2>&1; then
# For Ubuntu and Debian-based `bat` packages
# the `bat` program is named `batcat` on these systems
alias cat=$(which batcat)
export MANPAGER="sh -c 'col -bx | batcat -l man -p'"
export MANPAGER="$BASEDIR/manbat batcat"
elif command -v bat >/dev/null 2>&1; then
# Save the original system `cat` under `rcat`
alias rcat=$(which cat)
# For all other systems
alias cat=$(which bat)
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export MANPAGER="$BASEDIR/manbat bat"
fi