[Intel-gfx] [dim PATCH 2/7] dim: return error exit status on unknown subcommands
Jani Nikula
jani.nikula at intel.com
Fri Mar 24 16:11:54 UTC 2017
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
dim | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/dim b/dim
index 989674ab7a91..fc72cd619dbd 100755
--- a/dim
+++ b/dim
@@ -1840,11 +1840,12 @@ if ! declare -n subcmd=dim_alias_${subcommand//-/_} &> /dev/null || \
subcmd="$subcommand"
fi
-# if there's a function by the subcommand name, call it
+# look up the function by the subcommand name
subcmd_func=dim_${subcmd//-/_}
-if declare -f $subcmd_func >/dev/null; then
- $subcmd_func "$@"
-else
+if ! declare -f $subcmd_func >/dev/null; then
echoerr "'$subcommand' is not a dim command."
dim_usage
+ exit 1
fi
+
+$subcmd_func "$@"
--
2.1.4
More information about the Intel-gfx
mailing list