#!/bin/sh

#   display usage
if [ $# -eq 0 ]; then
    echo "USAGE: kaldi <command> [<options>]" 1>&2
    echo "Existing <command>:" 1>&2
    (cd @l_prefix@/libexec/kaldi && echo *) | fmt 1>&2
    exit 1
fi

#   take and verify command
cmd="$1"
shift
if [ ! -x @l_prefix@/libexec/kaldi/$cmd ]; then
    echo "ERROR: Kaldi command \"$cmd\" not found" 1>&2
    exit 1
fi

#   dispatch command
exec @l_prefix@/libexec/kaldi/$cmd ${1+"$@"}

