Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions core/scripts/cmtk.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ export CMTK_BINARY_DIR=${CMTK_BINARY_DIR:-@CMTK_BINARY_DIR_CONFIG@}
export CMTK_LIBRARY_DIR=${CMTK_BINARY_DIR:-@CMTK_LIBRARY_DIR_CONFIG@}

CMD=$1

# Basic help if we have been called without command or cmtk --help
if [ -z "$1" ] || [ "$1" = "--help" ] ; then
echo "CMTK makes the following commands available:"
ls "${CMTK_BINARY_DIR}"
echo -e "For help on a specific command, try:\n cmtk <command-name> --help"
exit 1
fi

CMDPATH=${CMTK_BINARY_DIR}/$CMD
shift

Expand All @@ -43,8 +52,8 @@ else
export LD_LIBRARY_PATH=${CMTK_LIBRARY_DIR}
fi

if echo "$CMD $@" | grep -q -e --help; then
[ "$CMD" = "--help" ] && man cmtk || man <( ${CMDPATH} --man )
if [ -z "$@" ] || [ "$@" = "--help" ] ; then
${CMDPATH} "--help"
else
${CMDPATH} "$@"
fi
Expand Down