Skip to contentSkip to conversation

bash completion: Remove deprecated consumer commands

PATCH New [email protected] 2 participants 5 messages Jul 29, 2013 – Aug 7, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 2/5 bash completion: Remove underscores in handler function names

From: Simon Marchi <[email protected]>

If the command name contains a dash, it is removed to derive the function name that will handle completion. For example, add-context becomes _lttng_cmd_addcontext. The functions with erroneous names were not getting called.

---
 extras/lttng-bash_completion |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
extras/lttng-bash_completion +3 -3
index efd5f58..a90820a 100644
@@ -20,7 +20,7 @@ _lttng_complete_sessions() {
 	return
 }
 
-_lttng_cmd_add_context() {
+_lttng_cmd_addcontext() {
 	local add_context_opts
 	add_context_opts=$(lttng add-context --list-options)
 
@@ -182,7 +182,7 @@ _lttng_cmd_disablechannel() {
 	esac
 }
 
-_lttng_cmd_disable_event() {
+_lttng_cmd_disableevent() {
 	local disable_event_opts
 	disable_channel_opts=$(lttng disable-event --list-options)
 
@@ -222,7 +222,7 @@ _lttng_cmd_list() {
 	esac
 }
 
-_lttng_cmd_set_session() {
+_lttng_cmd_setsession() {
 	local set_session_opts
 	set_session_opts=$(lttng set-session --list-options)
 
Signature · 1 line
1.7.1
#2 lore raw

PATCH 3/5 bash completion: Remove deprecated consumer commands

In reply to a message not in the archive

From: Simon Marchi <[email protected]>

enable/disable consumer were removed a while ago. Remove autocomplete for them to discourage people of using them.

---
 extras/lttng-bash_completion |   38 --------------------------------------
 1 files changed, 0 insertions(+), 38 deletions(-)
extras/lttng-bash_completion +0 -38
index a90820a..b5f861c 100644
@@ -125,44 +125,6 @@ _lttng_cmd_enableevent() {
 	esac
 }
 
-_lttng_cmd_enableconsumer() {
-	local enable_consumer_opts
-		enable_consumer_opts=$(lttng enable-consumer --list-options)
-
-	case $prev in
-	--session|-s)
-		_lttng_complete_sessions
-		return
-		;;
-	esac
-
-	case $cur in
-	-*)
-		COMPREPLY=( $(compgen -W "${enable_consumer_opts}" -- $cur) )
-		return
-		;;
-	esac
-}
-
-_lttng_cmd_disableconsumer() {
-	local disable_consumer_opts
-		disable_consumer_opts=$(lttng disable-consumer --list-options)
-
-	case $prev in
-	--session|-s)
-		_lttng_complete_sessions
-		return
-		;;
-	esac
-
-	case $cur in
-	-*)
-		COMPREPLY=( $(compgen -W "${disable_consumer_opts}" -- $cur) )
-		return
-		;;
-	esac
-}
-
 _lttng_cmd_disablechannel() {
 	local disable_channel_opts
 	disable_channel_opts=$(lttng disable-channel --list-options)
Signature · 1 line
1.7.1
#3 lore raw

PATCH 4/5 bash completion: Fix copy-paste typo

In reply to a message not in the archive

From: Simon Marchi <[email protected]>

---
 extras/lttng-bash_completion |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
extras/lttng-bash_completion +1 -1
index b5f861c..cc81557 100644
@@ -146,7 +146,7 @@ _lttng_cmd_disablechannel() {
 
 _lttng_cmd_disableevent() {
 	local disable_event_opts
-	disable_channel_opts=$(lttng disable-event --list-options)
+	disable_event_opts=$(lttng disable-event --list-options)
 
 	case $prev in
 	--session|-s)
Signature · 1 line
1.7.1
#4 lore raw

PATCH 5/5 bash completion: add calls to _lttng_complete_sessions

In reply to a message not in the archive

From: Simon Marchi <[email protected]>

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

---
 extras/lttng-bash_completion |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
extras/lttng-bash_completion +13 -1
index cc81557..bff8df7 100644
@@ -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
 }
 
Signature · 1 line
1.7.1
#5 lore raw

Re: [PATCH lttng-tools 1/5] bash completion: Remove --event for add-context

In reply to a message not in the archive

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Merged. Thanks!

[email protected]:

Quoted 14 lines

From: Simon Marchi <[email protected]>

--event has been remove in
601d5acf42ebdb05ff8aa19f12fd9bdad3602781.

extras/lttng-bash_completion | 3 --- 1 files changed, 0
insertions(+), 3 deletions(-)

(quoted diff) +0 -0

b/extras/lttng-bash_completion index b515be0..efd5f58 100644 --- a/extras/lttng-bash_completion +++ b/extras/lttng-bash_completion

Review _lttng_cmd_add_context() { --channel|-c) return · line 32

Quoted 1 line
(quoted diff) +0 -0
@@ -32,9 +32,6 @@ _lttng_cmd_add_context() { --channel|-c) return 
 ;; -	--event|-e) -		return -		;; --type|-t) return ;;

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)

iQEcBAEBCgAGBQJSAhe2AAoJEELoaioR9I02Tv8H/1Zh88eaot2/WFOe0tUhR41o dMu4Nd7yETzxXM71phCMk8lqe9eMsyWQ0qHwYkuP5w2r6qW9NTbjEiQU2diLzM5Y hz/fh4/C0juh7feVn+8wHFSqjUiZZnQzGAQpXhsILbgF9gKvDAgpqlTL5a8B6yL3 2h2Icy7p8yezumgt/tYjoczK5KNfqt4tpx70CErp6VRvh5ZDPMMvUINITrX8wVP0 EcX1Dk5B5zaH7ud6er1kGSskPPVEpIZiMunRru4OjbUSdHq4i1Tj5uYLv68V/b7h bLs/Fnme8UTWUQclARXazohz9lWSoid3mVqyXM+pJzkI1Kao1PfBpm6fe+0SioE= =Yhg4
-----END PGP SIGNATURE-----