[Intel-gfx] [maintainer-tools PATCH 5/8] dim: add list-commands subcommand to list all subcommands

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


Helper for completion.

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

diff --git a/dim b/dim
index 6fb496ea4192..2f6e6151a4b2 100755
--- a/dim
+++ b/dim
@@ -1115,6 +1115,12 @@ function assert_branch
 	fi
 }
 
+# Note: used by bash completion
+function dim_list_commands
+{
+	declare -F | grep -o " dim_[a-zA-Z_]*" | sed 's/^ dim_//;s/_/-/g'
+}
+
 function dim_alias
 {
 	# use posix mode to omit functions in set output
@@ -1178,7 +1184,7 @@ function dim_usage
 	echo "usage: $0 [OPTIONS] SUBCOMMAND [ARGUMENTS]"
 	echo
 	echo "The available subcommands are:"
-	declare -F | grep -o " dim_[a-zA-Z_]*" | sed 's/^ dim_/\t/'
+	dim_list_commands | sed 's/^/\t/'
 	echo
 	echo "See '$0 help' for more information."
 }
-- 
2.1.4



More information about the Intel-gfx mailing list