diff options
-rw-r--r-- | lib/messages.sh | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/messages.sh b/lib/messages.sh index 597ceaf..ab1533b 100644 --- a/lib/messages.sh +++ b/lib/messages.sh @@ -54,22 +54,34 @@ oh_info() oh_usage() { _util="$(echo "${0##*/}" | sed 's/-/_/g')" + + # Prevent field splitting in the evaluated echo command. + _old_ifs="${IFS}" + IFS= _usage_str="$(eval echo \$\{oh_str_usage_"${_util}"\})" + IFS="${_old_ifs}" + : "${_usage_str:=${oh_str_usage_none}}" printf '%s\n' "${_usage_str}" } oh_help() { - oh_usage _util="$(echo "${0##*/}" | sed 's/-/_/g')" + + # Prevent field splitting in the evaluated echo command. + _old_ifs="${IFS}" + IFS= _help_str="$(eval echo \$\{oh_str_help_"${_util}"\})" + IFS="${_old_ifs}" : "${_help_str:=${oh_str_help_none}}" + + oh_usage printf '%s\n' "${_help_str}" } oh_version() { printf "${oh_str_version}\n" \ - "${0##*/}" '@@package_name@@' '@@package_version@@' + "${0##*/}" '@@PACKAGE_NAME@@' '@@PACKAGE_VERSION@@' } |