[Intel-gfx] [maintainer-tools PATCH 8/8] completion: complete aliases like the actual command

Jani Nikula jani.nikula at intel.com
Thu Feb 18 16:20:54 UTC 2016


Map aliases to the actual commands. No need to know all the aliases.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 bash_completion | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/bash_completion b/bash_completion
index 4a9d981709a0..9f659b4ebcce 100644
--- a/bash_completion
+++ b/bash_completion
@@ -44,20 +44,26 @@ _dim ()
 		return 0
 	fi
 
+	# complete aliases like the actual command
+	local aliasref=$(dim list-aliases | sed -n "s/^${arg}\t\(.*\)/\1/p")
+	if [[ -n "$aliasref" ]]; then
+		arg="$aliasref"
+	fi
+
 	case "${arg}" in
 		push-branch)
 			COMPREPLY=( $( compgen -W "-f $nightly_branches" -- $cur ) )
 			;;
-		push-queued|pq|push-fixes|pf|push-next-fixes|pnf)
+		push-queued|push-fixes|push-next-fixes)
 			COMPREPLY=( $( compgen -W "-f" -- $cur ) )
 			;;
-		apply-branch|ab|sob)
+		apply-branch)
 			COMPREPLY=( $( compgen -W "-s $nightly_branches" -- $cur ) )
 			;;
-		apply-queued|aq|apply-fixes|af|apply-next-fixes|anf)
+		apply-queued|apply-fixes|apply-next-fixes)
 			COMPREPLY=( $( compgen -W "-s" -- $cur ) )
 			;;
-		magic-patch|mp)
+		magic-patch)
 			if [[ $args == 2 ]]; then
 				COMPREPLY=( $( compgen -o nospace -W "-a" -- $cur ) )
 			fi
@@ -65,7 +71,7 @@ _dim ()
 		tc|fixes)
 			# FIXME needs a git sha1
 			;;
-		check-patch|cp)
+		checkpatch)
 			# FIXME needs a git sha1
 			;;
 		pull-request)
@@ -85,7 +91,7 @@ _dim ()
 				COMPREPLY=( $( compgen -o nospace -W "drm- topic/" -- $cur ) )
 			fi
 			;;
-		checkout|co)
+		checkout)
 			if [[ $args == 2 ]]; then
 				COMPREPLY=( $( compgen -W "$nightly_branches" -- $cur ) )
 			fi
-- 
2.1.4



More information about the Intel-gfx mailing list