template: Don’t show usage on ARG/no value supplied

This commit is contained in:
tschettervictor
2025-04-23 21:39:31 -06:00
committed by GitHub
parent 7ad593535c
commit c16f48db0e

View File

@@ -335,7 +335,7 @@ for _jail in ${JAILS}; do
_arg_name=$(get_arg_name "${_line}") _arg_name=$(get_arg_name "${_line}")
_arg_value=$(get_arg_value "${_line}" "$@") _arg_value=$(get_arg_value "${_line}" "$@")
if [ -z "${_arg_value}" ]; then if [ -z "${_arg_value}" ]; then
warn "No value provided for arg: ${_arg_name}" error_exit "[ERROR]: No value provided for arg: ${_arg_name}"
fi fi
ARG_REPLACEMENTS="${ARG_REPLACEMENTS} -e 's/\${${_arg_name}}/${_arg_value}/g'" ARG_REPLACEMENTS="${ARG_REPLACEMENTS} -e 's/\${${_arg_name}}/${_arg_value}/g'"
done < "${bastille_template}/ARG" done < "${bastille_template}/ARG"
@@ -360,7 +360,7 @@ for _jail in ${JAILS}; do
_arg_name=$(get_arg_name "${_args}") _arg_name=$(get_arg_name "${_args}")
_arg_value=$(get_arg_value "${_args}" "$@") _arg_value=$(get_arg_value "${_args}" "$@")
if [ -z "${_arg_value}" ]; then if [ -z "${_arg_value}" ]; then
warn "No value provided for arg: ${_arg_name}" error_exit "[ERROR]: No value provided for arg: ${_arg_name}"
fi fi
# Build a list of sed commands like this: -e 's/${username}/root/g' -e 's/${domain}/example.com/g' # Build a list of sed commands like this: -e 's/${username}/root/g' -e 's/${domain}/example.com/g'
ARG_REPLACEMENTS="${ARG_REPLACEMENTS} -e 's/\${${_arg_name}}/${_arg_value}/g'" ARG_REPLACEMENTS="${ARG_REPLACEMENTS} -e 's/\${${_arg_name}}/${_arg_value}/g'"
@@ -464,5 +464,4 @@ for _jail in ${JAILS}; do
done done
info "Template applied: ${TEMPLATE}" info "Template applied: ${TEMPLATE}"
echo
done done