HCY72TQRK2H7LRTEPPHDWTUVINPHZBGMTASY7FJRYS2WXCBRSMYQC
lint || exit 1
run
usage() {
echo "$0: run all 'demo.sh' scripts using libdemo"
echo " -l|--lint: run linter first"
echo " -a|--auto: run in automatic mode"
echo " -h|--help|-?: Show usage"
}
do_lint=0
do_interactive=1
while [[ $# -gt 0 ]]; do
case $1 in
-l|--lint)
do_lint=1
shift
;;
-a|--auto)
do_interactive=0
shift
;;
-h|--help|-\?)
usage
exit 0
;;
-*)
echo "Unknown option $1"
exit 1
;;
*)
POSITIONAL_ARGS+=("$1") # save positional arg
shift
;;
esac
done
if [ "${do_lint}" = 1 ]; then
lint || exit 1
else
LIBDEMO_INTERACTIVE="${do_interactive}" run
fi
shellcheck_dir() {
local path="${1}"
shift
pushd "${path}" > /dev/null || return 1
set +e
local retval=0
while IFS= read -r f; do
if shellcheck -S style -x "${f}"; then
:
else
retval=1
fi
done < <(grep --exclude-dir .git "${@}" -l -R -e '^#\!.*sh' -e '^# shellcheck shell' | sort)
popd > /dev/null || return 1
return "${retval}"
}
# https://github.com/koalaman/shellcheck/blob/master/shellcheck.1.md
# Look for 'source'd files relative to the checked script
source-path=SCRIPTDIR
# Suggest adding a default case in `case` statements
enable=add-default-case
# Suggest explicitly using -n in `[ $var ]`
enable=avoid-nullary-conditions
# Turn on warnings for unassigned uppercase variables
# enable=check-unassigned-uppercase
# Turn on warnings for unquoted variables with safe values
enable=quote-safe-variables
# Suggest putting braces around all variable references
enable=require-variable-braces