#!/usr/bin/env sh
printf "
"
printf ""
printf "Man Page | "
printf "Description | "
printf "
"
find man build/man -type f -name '*.[1-9]' | sort -r | while IFS= read -r file; do
base=$(basename "$file")
name=$(echo "$base" | rev | cut -d '.' -f 2- | rev)
section=$(echo "$base" | rev | cut -d '.' -f 1)
description=$(grep '^\.Nd' "$file" | cut -d ' ' -f 2-)
prefix=$(echo "$name" | cut -d '-' -f 1)
case "$prefix" in
"telodendria"*)
if [ "$1" = "dev" ]; then
continue
fi
;;
*)
if [ "$1" = "user" ]; then
continue
fi
;;
esac
printf ""
printf "$name($section) | "
printf "$description | "
printf "
"
done
printf "
"