add setup-man

Fri, 05 Apr 2019 00:45:33 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Fri, 05 Apr 2019 00:45:33 -0500
changeset 756
8bc91181db9d
parent 755
60ee3259bc01
child 757
54fdb5a6bf67

add setup-man

.profile.common file | annotate | diff | comparison | revisions
bin/homedir-setup file | annotate | diff | comparison | revisions
bin/setup-man file | annotate | diff | comparison | revisions
--- a/.profile.common
+++ b/.profile.common
@@ -7,6 +7,8 @@ make -s -C ~/.ssh || {
   chmod 600 $_
 }
 
+export MANPATH=$HOME/.man:
+
 export EDITOR=vim
 export SUDO_EDITOR=$HOME/bin/privim
 export LESS='Ri'
--- a/bin/homedir-setup
+++ b/bin/homedir-setup
@@ -50,6 +50,8 @@ if [ "$minimal" -ne 1 ]; then
       pull .asdf/plugins/$LANG
     fi
   done
+
+  bin/setup-man || true
 fi
 
 # Get rid of older stuff
new file mode 100755
--- /dev/null
+++ b/bin/setup-man
@@ -0,0 +1,16 @@
+#!/bin/sh
+set -eu
+
+cd $(hg root)
+
+SOURCES="${@:-$(hg stat -Aqn -I 'bin/*')}"
+MAN1=".man/man1"
+
+mkdir -p $MAN1 || true
+
+for SRC in $(grep -El '^=(head|cut)' $SOURCES); do
+  DST="${MAN1}/$(basename $SRC).1"
+  if [ ! -f $DST ] || [ "$SRC" -nt "$SRC" ]; then
+    pod2man -v --errors=stderr "$SRC" "$DST"
+  fi
+done

mercurial