summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/cmd.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/cmd.sh b/lib/cmd.sh
index 0558971..fa9b1ad 100644
--- a/lib/cmd.sh
+++ b/lib/cmd.sh
@@ -84,10 +84,13 @@ is_cmd()
run_cmd()
{
local cmd="${1}"
+ local cmd_clean=
shift
+ cmd_clean="$(printf '%s' "${cmd}" | \
+ tr '[A-Z]' '[a-z]' | tr -C '[a-z0-9_]' '_')"
if is_cmd "${cmd}"; then
- "cmd_${cmd}_main" "${@}"
+ "cmd_${cmd_clean}_main" "${@}"
else
error 1 "$(get_msg 'cmd_not_found')" "${cmd}"
fi