coreutils/man/viewman
Pádraig Brady 87219034b7 doc: use TERM=dumb rather than HELP_NO_MARKUP to disable markup
This is a more standard mechanism to disable markup.

* src/system.h (oputs_): Logic change to honor TERM=dumb,
rather than HELP_NO_MARKUP=something.
* doc/coreutils.texi: Adjust the description for --help.
* man/local.mk: Ensure TERM is set to something,
so that man pages have links included.
* man/viewman: Just honor users $TERM.
* tests/misc/getopt_vs_usage.sh: Remove env var complication,
as TERM is unset automatically.
* tests/misc/usage_vs_refs.sh: Likewise.
* NEWS: Adjust the change in behavior note.
2026-01-22 11:42:47 +00:00

33 lines
765 B
Bash
Executable File

#!/bin/sh
# Generate and view man page with less, for passed command name
# Note to get man to behave like this you can also:
# export MANROFFOPT=-P-i
# export LESS=-R
# export MANPAGER=less
unset GROFF_NO_SGR
hdir=$(dirname "$0")
CONFIG_HEADER="$hdir"/../lib/config.h
grep '^#define BOLD_MAN_REFS 1' $CONFIG_HEADER > /dev/null &&
BOLD_REFS=--bold-refs
man="$1"; cmd="$1"
test "$1" = 'test' && cmd='['
test "$1" = '[' && man='test'
test "$1" = 'install' && cmd='ginstall'
test "$1" = 'ginstall' && man='install'
"$hdir"/help2man \
--include="$hdir"/../man/$man.x \
$BOLD_REFS \
--loose-indent \
"$hdir"/../src/$cmd |
preconv | # convert utf-8 chars like in Author names to groff compat
groff -Tutf8 -man -P-i -rLL=${MANWIDTH:-$COLUMNS}n |
less -R