[Intel-gfx] [dim PATCH 2/4] dim: move dim update check near the end

Jani Nikula jani.nikula at intel.com
Tue Apr 4 13:59:00 UTC 2017


Reserve the middle part of the script for function and alias definitions
only.

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

diff --git a/dim b/dim
index 8671bcb84845..a76e4e4d3f09 100755
--- a/dim
+++ b/dim
@@ -204,6 +204,10 @@ if [ "$subcommand" != "setup" ] && [ "$subcommand" != "help" ] && [ "$subcommand
 fi
 
 #
+# Only function and alias definitions until the subcommand handling at the end.
+#
+
+#
 # Variable naming convetion:
 #
 # repo:
@@ -333,10 +337,6 @@ function git_branch_exists # branch
 	fi
 }
 
-if [[ "$(($(date +%s) % 100))" -eq "0" ]] ; then
-        dim_uptodate || true
-fi
-
 # get message id from file
 # $1 = file
 message_get_id ()
@@ -1893,6 +1893,11 @@ function dim_usage
 	echo "See '$dim help' for more information."
 }
 
+# occasional check for dim updates
+if [[ "$(($(date +%s) % 100))" -eq "0" ]] ; then
+        dim_uptodate || true
+fi
+
 # dim subcommand aliases (with bash 4.3+)
 if ! declare -n subcmd=dim_alias_${subcommand//-/_} &> /dev/null || \
 		test -z "${subcmd:-}"; then
-- 
2.1.4



More information about the Intel-gfx mailing list