bin/setup-man

Sun, 05 Mar 2023 18:47:45 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 05 Mar 2023 18:47:45 -0500
changeset 1062
77bf3b44f6f9
parent 756
8bc91181db9d
permissions
-rwxr-xr-x

Add format-on-write for elixir and go

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