sed -Ene "s/^[[:space:]]*(['\"])([[:alnum:]]*)\1[[:space:]]*\).*##-[[:space:]]*(.*)/\-\2\t\t: \3/p"<"$0"
sed -Ene "s/^[[:space:]]*(['\"])([-[:alnum:]]*)*\1[[:space:]]*\)[[:space:]]*set[[:space:]]*--[[:space:]]*(['\"])[@$]*\3[[:space:]]*(['\"])(-[[:alnum:]])\4.*##-[[:space:]]*(.*)/\2\t\t: \6/p"<"$0"
) | sort --ignore-case
)"
if [ -n"$overview" ];then
printf"Overview\n%s\n""$overview"
fi
if [ -n"$usage" ];then
printf"\nUsage:\n%s\n""$usage"
fi
}
###
### If there is a library directory (lib/) relative to the
### script's location by default), then attempt to source
### the *.bash files located there.
###
if [ -n"${LIBRARY_PATH}" ] \
&& [ -d"${LIBRARY_PATH}" ];then
forlibraryin"${LIBRARY_PATH}"*.bash;do
if [ -e"${library}" ];then
# shellcheck disable=SC1090
."${library}"
fi
done
fi
## @fn main()
## @brief This is the main program loop.
## @details
## This is where the logic for the program lives; it's
## called when the script is run as a script (i.e., not
## when it's sourced or included).
main() {
trap die ERR
###
### set values from their defaults here
###
word="${DEFAULT_WORD}"
###
### process long options here
###
forargin"$@";do
shift
case"$arg"in
'--word') set -- "$@""-w" ;; ##- see -w
'--help') set -- "$@""-h" ;; ##- see -h
*) set -- "$@""$arg" ;;
esac
done
###
### process short options here
###
OPTIND=1
whilegetopts"w:h" opt;do
case"$opt"in
'w') word="$OPTARG" ;; ##- set the word to be processed
'h')
display_usage
exit 0
;; ##- view the help documentation
*)
printf"Invalid option '%s'""$opt"1>&2
display_usage 1>&2
exit 1
;;
esac
done
shift"$((OPTIND -1))"
###
### process positional arguments
###
forfilein"$@";do
printf"received argument: '%s'\n""$file"
done
###
### program logic goes here
###
printf"%s %s %s the %s is the word\n""$word""$word""$word""$word"
}
# if we're not being sourced and there's a function named `main`, run it