diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cmd.sh | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -39,7 +39,7 @@ load_cmds() print_cmd_summaries() { - local padding cmd summary + local padding cmd cmd_clean summary padding="$(printf '%24s' '')" for cmd in ${PKGLIBCMD}; do @@ -50,7 +50,9 @@ print_cmd_summaries() else printf ' %-20s ' "${cmd}" fi - summary="$(get_msg "cmd_${cmd}_summary")" + cmd_clean="$(printf '%s' "${cmd}" | \ + tr '[A-Z]' '[a-z]' | tr -C '[a-z0-9_]' '_')" + summary="$(get_msg "cmd_${cmd_clean}_summary")" printf '%s\n' "${summary}" | fold -s -w 56 | \ sed "2,\$s/^/${padding}/;" done @@ -58,11 +60,13 @@ print_cmd_summaries() print_cmd_usage() { - local cmd usage + local cmd cmd_clean usage cmd="${1}" - usage="$(get_msg "cmd_${cmd}_usage")" + cmd_clean="$(printf '%s' "${cmd}" | \ + tr '[A-Z]' '[a-z]' | tr -C '[a-z0-9_]' '_')" + usage="$(get_msg "cmd_${cmd_clean}_usage")" printf "$(get_msg 'cmd_usage')\n" "${0}" "${cmd}" "${usage}" } |