declare -a MODULES=()
PUPPET_ENV='*'
-ENV_DIR="/etc/puppetlabs/code/environments"
+DEFAULT_ENV_DIR="/etc/puppetlabs/code/environments"
+ENV_DIR="${DEFAULT_ENV_DIR}"
DESCRIPTION=$( cat <<-EOF
Retrieving version number of given Puppet module(s) in all environments.
If not given, '*' (all) environments are searched.
-D|--dir PUPPET_ENV_DIR
The directory, where the Puppet r10k environments are checked out
- (Default: '${ENV_DIR}').
+ (Default: '${DEFAULT_ENV_DIR}').
EOF
echo
while [[ "$i" -lt "${len}" ]] ; do
arg="${REMAINING_OPTS[$i]}"
+ debug "Evaluating option '${CYAN}${arg}${NORMAL}' ..."
case "${arg}" in
-E|--env|--environment)
j=$(( $i + 1 ))
PUPPET_ENV="${REMAINING_OPTS[$j]}"
+ debug "Puppet environment is now: '${CYAN}${PUPPET_ENV}${NORMAL}'."
i=$(( $i + 2 ))
;;
-D|--dir)
j=$(( $i + 1 ))
ENV_DIR="${REMAINING_OPTS[$j]}"
+ debug "Puppet environment directory is now: '${CYAN}${ENV_DIR}${NORMAL}'."
i=$(( $i + 2 ))
;;
- *) echo -e "Internal error - option '${RED}${arg}${NORMAL} was wrong!"
+ *) echo -e "Internal error - option '${RED}${arg}${NORMAL}' was wrong!"
exit 1
;;
esac