#! /bin/bash learn-harmony()( set -eu [ "${1:-}" != "-d" ] || { set -x ; shift ; } trap '[ "$?" = "0" ] || >&2 echo ABNORMAL TERMINATION' EXIT BASE_DIR=$(readlink -f "$(dirname "${BASH_SOURCE}")/..") SCRIPTS_DIR=$(readlink -f "$(dirname "${BASH_SOURCE}")") . "${SCRIPTS_DIR}/common" export PATH=$SCRIPTS_DIR:$PATH _short_help(){ cat <<-EOM NAME learn-harmony -- Harmony Learning Tool prototype ($(basename ${BASE_DIR}) example) SYNOPSYS learn-harmony [GLOBAL_OPTIONS] COMMAND [OPTIONS] learn-harmony list # List learning steps learn-harmony show STEP # Show instruction of step STEP learn-harmony check [STEP] # Verify that your ready to begin step STEP+1 EOM } _extra_help(){ cat <<-EOM GLOBAL_OPTIONS -d Debug mode. WARNINGS This script is experimetal. Use with caution. EOM } case "${1:-}" in -h|--help|"") _short_help _extra_help ;; ls|list) echo "not implemented" ;; show) echo "not implemented" ;; verify) echo "not implemented" ;; *) _warn "Unknown COMMAND '$1'" exit 1 ;; esac ) [ "$0" != "${BASH_SOURCE}" ] || learn-harmony "${@}"