#!/bin/sh

# Standard thingy to run a program not in /usr/bin

PROGPATH=/usr/libexec/stacks/bin
PROG=help

if ! [ "$*" = "" ] ; then
    PROG="$1" ; shift
fi

if [ "$PROG" = help -o "$PROG" = -help -o "$PROG" = -h ] ; then
    echo "Stacks - a pipeline for building loci from short-read sequences"
    echo "         v"`dpkg-query -f'${Version}' -W stacks | cut -d- -f1` 'http://creskolab.uoregon.edu/stacks/'
    echo
    echo "This is the Stacks wrapper script for Debian. Usage:"
    echo "    stacks <progname> <args...>"
    echo
    echo "Programs available are:"
    ls "$PROGPATH" | grep -v .pl | column
    echo
    echo "Or else add $PROGPATH to your \$PATH to invoke the commands directly."
    exit 0
fi

export PATH="$PROGPATH:$PATH"
exec "$PROGPATH/$PROG" "$@"
