[PATCH 5/9] dim: group subcommand handling together

Jani Nikula jani.nikula at intel.com
Thu Mar 29 08:45:57 UTC 2018


Simple code movement for clarity.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 dim | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/dim b/dim
index b41beca7301b..60d4d36ef25f 100755
--- a/dim
+++ b/dim
@@ -2290,6 +2290,14 @@ if ! declare -n subcmd=dim_alias_${subcommand//-/_} &> /dev/null || \
 	subcmd="$subcommand"
 fi
 
+# look up the function by the subcommand name
+subcmd_func=dim_${subcmd//-/_}
+if ! declare -f $subcmd_func >/dev/null; then
+	echoerr "'$subcommand' is not a dim command."
+	dim_usage
+	exit 1
+fi
+
 #
 # Sanity checks.
 #
@@ -2301,14 +2309,6 @@ if [[ -n "${__dim_running:-}" ]]; then
 fi
 export __dim_running=1
 
-# look up the function by the subcommand name
-subcmd_func=dim_${subcmd//-/_}
-if ! declare -f $subcmd_func >/dev/null; then
-	echoerr "'$subcommand' is not a dim command."
-	dim_usage
-	exit 1
-fi
-
 # Commands useful for developers don't need a full dim setup
 if list_developer_commands | grep -qx $subcmd; then
 	if [ -r $DIM_PREFIX/drm-rerere/$integration_config ]; then
-- 
2.11.0



More information about the dim-tools mailing list