Files
mlpack/CMake/allexec2man.sh
T
Barak A. Pearlmutter 8af6c2e7cf Tweak manpage-generation scripts {,all}exec2man.sh
Allow executable being documented by exec2man.sh to be specified with
a relative path.

Output cogent usage instructions when invoked incorrectly.

Use politically correct $(...) as `...` has been deprecated by
glorious POSIX.

Allow allexec2man.sh to use relative paths to exec2man.sh
2018-04-06 15:14:28 +01:00

28 lines
720 B
Bash
Executable File

#!/bin/bash
set -e
if [ $# != 2 ]; then
echo "Convert all of the executables in this directory that are not tests to man"
echo "pages in the given directory."
echo
echo "Usage:"
echo " allexec2man.sh /full/path/of/exec2man.sh output_directory/"
echo
echo "For the executable 'cheese', the file 'cheese.1.gz' will be created in the"
echo "output directory."
exit 1
fi
exec2man="$1"
outdir="$2"
mkdir -p "$outdir"
for program in $(find . -type f -executable -iname 'mlpack_*' | \
grep -v '[.]$' | \
grep -v '_test$'); do
echo "Generating man page for $program...";
"$exec2man" "$program" "$outdir/$program.1"
gzip -f "$outdir/$program.1"
done