File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717
1818set -euo pipefail
1919
20-
2120# # @var SCRIPT_PATH
2221# # @brief path to where the script lives
2322declare SCRIPT_PATH
2423# shellcheck disable=SC2034
2524SCRIPT_PATH=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd -P) "
2625
26+ # # @var LIBRARY_PATH
27+ # # @brief location where libraries to be included reside
28+ declare LIBRARY_PATH
29+ LIBRARY_PATH=" ${SCRIPT_PATH} /lib/"
2730
2831# # @var DEFAULT_WORD
2932# # @brief default value for the 'word' CLI parameter
@@ -127,6 +130,24 @@ main() {
127130 trap die ERR
128131
129132
133+ # ##
134+ # ## If there is a library directory (lib/) relative to the
135+ # ## script's location by default), then attempt to source
136+ # ## the *.bash files located there.
137+ # ##
138+
139+
140+ if [ -n " ${LIBRARY_PATH} " ] \
141+ && [ -d " ${LIBRARY_PATH} " ] ; then
142+ for library in " ${LIBRARY_PATH} " * .bash ; do
143+ if [ -e " ${library} " ] ; then
144+ # shellcheck disable=SC1090
145+ . " ${library} "
146+ fi
147+ done
148+ fi
149+
150+
130151 # ##
131152 # ## set values from their defaults here
132153 # ##
You can’t perform that action at this time.
0 commit comments