[lttng-dev] [PATCH lttng-tools 5/5] bash completion: add calls to _lttng_complete_sessions

simon.marchi at polymtl.ca simon.marchi at polymtl.ca
Mon Jul 29 15:22:45 EDT 2013


From: Simon Marchi <simon.marchi at polymtl.ca>

Improve a little bit the dummy implementation of
_lttng_complete_sessions and add two calls where it can be useful.

Reported-by: Daniel U. Thibault <daniel.thibault at drdc-rddc.gc.ca>
Signed-off-by: Simon Marchi <simon.marchi at polymtl.ca>
---
 extras/lttng-bash_completion |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/extras/lttng-bash_completion b/extras/lttng-bash_completion
index cc81557..bff8df7 100644
--- a/extras/lttng-bash_completion
+++ b/extras/lttng-bash_completion
@@ -16,7 +16,12 @@
 #
 
 _lttng_complete_sessions() {
-	# TODO, maybe have a lttng list --simple or something like that
+	# TODO
+	# This code does nothing for now. When there is a mecanism to get the
+	# existing sessions, use it to fill the sessions variable.
+	local sessions
+	sessions=""
+	COMPREPLY=( $(compgen -W "${sessions}" -- $cur) )
 	return
 }
 
@@ -181,6 +186,9 @@ _lttng_cmd_list() {
 		COMPREPLY=( $(compgen -W "${list_opts}" -- $cur) )
 		return
 		;;
+	*)
+		_lttng_complete_sessions
+		return
 	esac
 }
 
@@ -193,6 +201,10 @@ _lttng_cmd_setsession() {
 		COMPREPLY=( $(compgen -W "${set_session_opts}" -- $cur) )
 		return
 		;;
+	*)
+		_lttng_complete_sessions
+		return
+		;;
 	esac
 }
 
-- 
1.7.1




More information about the lttng-dev mailing list