diff options
author | James Pannacciulli <jpnc@jpnc.info> | 2017-06-12 11:21:21 -0700 |
---|---|---|
committer | James Pannacciulli <jpnc@jpnc.info> | 2017-06-12 11:21:21 -0700 |
commit | 1b09c0814cd1e5d5a57be0c45c879fe0b146d220 (patch) | |
tree | 08675c158599f6feff08a6c4d244b729c5e5c1bb /ariketa.sh | |
parent | 479f4a166b5d81ce6b363cce13c9763f09c74211 (diff) | |
download | ariketa-1b09c0814cd1e5d5a57be0c45c879fe0b146d220.tar.gz ariketa-1b09c0814cd1e5d5a57be0c45c879fe0b146d220.tar.bz2 |
move sample examples out of config, show USAGE if no examples
Diffstat (limited to 'ariketa.sh')
-rw-r--r-- | ariketa.sh | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -27,6 +27,20 @@ _sourced? || { ARIKETA_DIR=$(_ariketa.dir) +# load examples array +source "${ARIKETA_DIR:?}/config/examples.sh" + +# if examples array has no content, bail with USAGE text +(( ${#_examples[@]} )) || { + >&2 printf "** %s\n" \ + "" ""\ + "$(declare -p _examples)"\ + "_examples array needs content -- see 'configuration' below"\ + "" "" + _ariketa.help + return $? +} + # preserve multiline commands as such in history shopt -s lithist @@ -39,8 +53,5 @@ 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 |