bin/setup-man

Tue, 18 Jan 2022 17:21:10 -0600

author
Meredith Howard <mhoward@roomag.org>
date
Tue, 18 Jan 2022 17:21:10 -0600
changeset 973
20158142fa43
parent 756
8bc91181db9d
permissions
-rwxr-xr-x

fix brd/brf aliases

756
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 #!/bin/sh
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 set -eu
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 cd $(hg root)
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6 SOURCES="${@:-$(hg stat -Aqn -I 'bin/*')}"
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 MAN1=".man/man1"
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 mkdir -p $MAN1 || true
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11 for SRC in $(grep -El '^=(head|cut)' $SOURCES); do
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12 DST="${MAN1}/$(basename $SRC).1"
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13 if [ ! -f $DST ] || [ "$SRC" -nt "$SRC" ]; then
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14 pod2man -v --errors=stderr "$SRC" "$DST"
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15 fi
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
16 done

mercurial