Add a script for conveniently creating new library man pages.

This commit is contained in:
Jordan Bancino 2023-02-16 00:55:10 +00:00
parent 6735c101ec
commit 2ce43ce457

35
tools/bin/new-man Executable file
View file

@ -0,0 +1,35 @@
#!/usr/bin/env sh
man="$1"
section="$2"
if [ -z "$man" ] || [ -z "$section" ]; then
echo "Usage: $0 <man> <section>"
exit 1
fi
file="man/man${section}/${man}.${section}"
if [ -f "$file" ]; then
echo "File $file already exists. Move it out of the way."
exit 1
fi
(
mdocdate=$(date "+%B %d %Y")
uppercase=$(echo "$man" | tr '[:lower:]' '[:upper:]')
echo ".Dd \$Mdocdate: February 16 2023 ${mdocdate} \$"
echo ".Dt ${uppercase} ${section}"
echo ".Os Telodendria Project"
echo ".Sh NAME"
echo ".Nm ${man}"
echo ".Nd {SET DESCRIPTION HERE}"
echo ".Sh SYNOPSIS"
echo ".In ${man}.h"
echo ".Sh DESCRIPTION"
echo ".Sh RETURN VALUES"
echo ".Sh SEE ALSO"
) > "$file"
$EDITOR "$file"