#!/bin/bash

for i in *.md; do
    _manfile=$(basename "${i}" .md)
    pandoc "${i}" -s -t man > "${_manfile}"
done

# Use ./*glob* or -- *glob* so names with dashes won't become options.
# shellcheck disable=2035
_manpagefiles=$(ls *.1)
if [ -f ../manpages ]; then
    rm ../manpages
fi
for i in ${_manpagefiles}; do
    echo "debian/manpages.d/${i}" >> ../manpages
done
