#!/usr/bin/env bash
set -u

export DIR_ORTHOLOGER=${DIR_ORTHOLOGER="$(cd -P "$(dirname "${BASH_SOURCE[0]}")"/../ && pwd)"}
[[ -d "$DIR_ORTHOLOGER" ]] || { echo "FATAL: unable to determine DIR_ORTHOLOGER! Got <$DIR_ORTHOLOGER>." 1>&2; exit 255; }

source $DIR_ORTHOLOGER/bin/common_odb.sh
configure_step_readonly
[[ $# -ge 1 ]] || {
    help_header_msg "usage: $0 <key>"
    echo "where <key> can be any of the below:"
    echo " .orthologer     main help         'orthologer.sh -h'"
    echo " .manage         management help   'orthologer.sh manage -h'"
    echo " .               extended help     'orthologer.sh -H .'"
    echo " .variables      user setable variables"
    echo " .steps          list of all steps"
    echo " <STEPID>        help for given step id"
    exit 0
}
arg="$1"
arg="${arg^^}"
arg5="${arg:0:5}"
[[ "$arg5" == ".ORTH" ]] && { usage; exit 0; }
[[ "$arg5" == ".MANA" ]] && { export CMD_MANAGE=manage_project.sh; source $DIR_ORTHOLOGER/bin/manage_project.sh -h ; exit 0; }
help_xxx $1



