forked from lda/telodendria
Add a script for conveniently creating new library man pages.
This commit is contained in:
parent
6735c101ec
commit
2ce43ce457
1 changed files with 35 additions and 0 deletions
35
tools/bin/new-man
Executable file
35
tools/bin/new-man
Executable 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"
|
Loading…
Reference in a new issue