diff options
Diffstat (limited to 'ariketa.sh')
-rw-r--r-- | ariketa.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/ariketa.sh b/ariketa.sh new file mode 100644 index 0000000..658588f --- /dev/null +++ b/ariketa.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +_ariketa.dir () { + local _ariketa_filename _ariketa_dir + _ariketa_filename="${BASH_SOURCE[$(( ${#BASH_SOURCE[@]} - 1 ))]}" + [[ "$_ariketa_filename" == */* ]] && _ariketa_dir="${_ariketa_filename%/*}" + + # get an absolute path to ariketa in case we need it + _ariketa_dir=$(cd "${_ariketa_dir:-$PWD}" && printf "%s" "$PWD") + printf "%s" "$_ariketa_dir" +} + + +_ariketa.help () { + >&2 printf "%s\n" "$(<USAGE)" + return 1 +} + +_sourced? () { + [[ ${FUNCNAME[$(( ${#FUNCNAME[@]} - 1 ))]} == "source" ]] +} + +_sourced? || { + _ariketa.help + exit $? +} + +ARIKETA_DIR=$(_ariketa.dir) + +# preserve multiline commands as such in history +shopt -s lithist + +# load presentation prompt +source "${ARIKETA_DIR:?}/lib/prompt.sh" + +# load misc functions +source "${ARIKETA_DIR:?}/lib/functions.sh" + +# set up bash macros to page through examples +source "${ARIKETA_DIR:?}/lib/bindings.sh" + +# load examples array +source "${ARIKETA_DIR:?}/config/examples.sh" + +# unset example index/directionality markers +unset _I _D |