#!/bin/sh
MANDIR=debian/mans
mkdir -p $MANDIR

VERSION=`dpkg-parsechangelog | awk '/^Version:/ {print $2}' | sed -e 's/^[0-9]*://' -e 's/-.*//' -e 's/[+~]dfsg$//'`

AUTHOR=".SH AUTHOR\nThis manpage was written by $DEBFULLNAME for the Debian distribution and
can be used for any other usage of the program.
"

progname=centrifuge
help2man --no-info --no-discard-stderr --help-option=" -h" \
         --name='rapid and memory-efficient system for classification of DNA sequences' \
            --version-string="$VERSION" /usr/bin/${progname} > $MANDIR/${progname}.1
echo $AUTHOR >> $MANDIR/${progname}.1

progname=centrifuge-build
help2man --no-info --no-discard-stderr --help-option=" -h" \
         --name='building index on all complete bacterial and viral genomes' \
            --version-string="$VERSION" /usr/bin/${progname} > $MANDIR/${progname}.1
echo $AUTHOR >> $MANDIR/${progname}.1

progname=centrifuge-compress
help2man --no-info --no-discard-stderr --help-option=" " \
         --name='genome compression in the database construction' \
            --version-string="$VERSION" /usr/bin/${progname} \
            | sed 's/USAGE: perl centrifuge\\-compress.pl/centrifuge\-compress/' > $MANDIR/${progname}.1
echo $AUTHOR >> $MANDIR/${progname}.1

progname=centrifuge-download
help2man --no-info --no-discard-stderr --help-option=" " \
         --name='centrifuge helper to download databases' \
            --version-string="$VERSION" /usr/bin/${progname} > $MANDIR/${progname}.1
echo $AUTHOR >> $MANDIR/${progname}.1

progname=centrifuge-inspect
help2man --no-info --discard-stderr --help-option=" -h" \
         --name='inspecting the centrifuge index' \
            --version-string="$VERSION" /usr/bin/${progname} > $MANDIR/${progname}.1
echo $AUTHOR >> $MANDIR/${progname}.1

cat <<EOT
Please enhance the help2man output.
The following web page might be helpful in doing so:
    http://liw.fi/manpages/
EOT

