aboutsummaryrefslogtreecommitdiffstats
path: root/ariketa.sh
diff options
context:
space:
mode:
authorJames Pannacciulli <jpnc@jpnc.info>2017-06-11 11:06:44 -0700
committerJames Pannacciulli <jpnc@jpnc.info>2017-06-11 16:28:32 -0700
commit8127bf73501c335519dae40101c3b850c4a64e54 (patch)
treeea3a9b7b3991fda0e23062f89fde6c7177da56d7 /ariketa.sh
downloadariketa-8127bf73501c335519dae40101c3b850c4a64e54.tar.gz
ariketa-8127bf73501c335519dae40101c3b850c4a64e54.tar.bz2
ariketa first commit
ariketa: bash example code quickloader for presentations
Diffstat (limited to 'ariketa.sh')
-rw-r--r--ariketa.sh46
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