Reorder functions _lttng_cmd_* functions in bash completion
[lttng-tools.git] / extras / lttng-bash_completion
index b515be08d484c9985e921556d9c313c0400d73e7..d5a58f38da5bc9b0e4d3bfef004a846e2fad91d2 100644 (file)
 #
 
 _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
 }
 
-_lttng_cmd_add_context() {
+_lttng_cmd_addcontext() {
        local add_context_opts
        add_context_opts=$(lttng add-context --list-options)
 
@@ -32,9 +37,6 @@ _lttng_cmd_add_context() {
        --channel|-c)
                return
                ;;
-       --event|-e)
-               return
-               ;;
        --type|-t)
                return
                ;;
@@ -48,6 +50,17 @@ _lttng_cmd_add_context() {
        esac
 }
 
+_lttng_cmd_calibrate() {
+       local calibrate_opts
+       calibrate_opts=$(lttng calibrate --list-options)
+
+       case $cur in
+       -*)
+               COMPREPLY=( $(compgen -W "${calibrate_opts}" -- $cur) )
+               ;;
+       esac
+}
+
 _lttng_cmd_create() {
        local create_opts
        create_opts=$(lttng create --list-options)
@@ -80,10 +93,9 @@ _lttng_cmd_destroy() {
                ;;
        esac
 }
-
-_lttng_cmd_enablechannel() {
-       local enable_channel_opts
-       enable_channel_opts=$(lttng enable-channel --list-options)
+_lttng_cmd_disablechannel() {
+       local disable_channel_opts
+       disable_channel_opts=$(lttng disable-channel --list-options)
 
        case $prev in
        --session|-s)
@@ -94,15 +106,14 @@ _lttng_cmd_enablechannel() {
 
        case $cur in
        -*)
-               COMPREPLY=( $(compgen -W "${enable_channel_opts}" -- $cur) )
+               COMPREPLY=( $(compgen -W "${disable_channel_opts}" -- $cur) )
                return
                ;;
        esac
 }
-
-_lttng_cmd_enableevent() {
-       local enable_event_opts
-       enable_event_opts=$(lttng enable-event --list-options)
+_lttng_cmd_disableevent() {
+       local disable_event_opts
+       disable_event_opts=$(lttng disable-event --list-options)
 
        case $prev in
        --session|-s)
@@ -112,44 +123,19 @@ _lttng_cmd_enableevent() {
        --channel|-c)
                return
                ;;
-       --probe)
-               return
-               ;;
-       --function)
-               return
-               ;;
-       esac
-
-       case $cur in
-       -*)
-               COMPREPLY=( $(compgen -W "${enable_event_opts}" -- $cur) )
-               return
-               ;;
-       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) )
+               COMPREPLY=( $(compgen -W "${disable_event_opts}" -- $cur) )
                return
                ;;
        esac
 }
 
-_lttng_cmd_disableconsumer() {
-       local disable_consumer_opts
-               disable_consumer_opts=$(lttng disable-consumer --list-options)
+_lttng_cmd_enablechannel() {
+       local enable_channel_opts
+       enable_channel_opts=$(lttng enable-channel --list-options)
 
        case $prev in
        --session|-s)
@@ -160,48 +146,35 @@ _lttng_cmd_disableconsumer() {
 
        case $cur in
        -*)
-               COMPREPLY=( $(compgen -W "${disable_consumer_opts}" -- $cur) )
+               COMPREPLY=( $(compgen -W "${enable_channel_opts}" -- $cur) )
                return
                ;;
        esac
 }
 
-_lttng_cmd_disablechannel() {
-       local disable_channel_opts
-       disable_channel_opts=$(lttng disable-channel --list-options)
+_lttng_cmd_enableevent() {
+       local enable_event_opts
+       enable_event_opts=$(lttng enable-event --list-options)
 
        case $prev in
        --session|-s)
                _lttng_complete_sessions
                return
                ;;
-       esac
-
-       case $cur in
-       -*)
-               COMPREPLY=( $(compgen -W "${disable_channel_opts}" -- $cur) )
+       --channel|-c)
                return
                ;;
-       esac
-}
-
-_lttng_cmd_disable_event() {
-       local disable_event_opts
-       disable_channel_opts=$(lttng disable-event --list-options)
-
-       case $prev in
-       --session|-s)
-               _lttng_complete_sessions
+       --probe)
                return
                ;;
-       --channel|-c)
+       --function)
                return
                ;;
        esac
 
        case $cur in
        -*)
-               COMPREPLY=( $(compgen -W "${disable_event_opts}" -- $cur) )
+               COMPREPLY=( $(compgen -W "${enable_event_opts}" -- $cur) )
                return
                ;;
        esac
@@ -222,10 +195,13 @@ _lttng_cmd_list() {
                COMPREPLY=( $(compgen -W "${list_opts}" -- $cur) )
                return
                ;;
+       *)
+               _lttng_complete_sessions
+               return
        esac
 }
 
-_lttng_cmd_set_session() {
+_lttng_cmd_setsession() {
        local set_session_opts
        set_session_opts=$(lttng set-session --list-options)
 
@@ -234,6 +210,10 @@ _lttng_cmd_set_session() {
                COMPREPLY=( $(compgen -W "${set_session_opts}" -- $cur) )
                return
                ;;
+       *)
+               _lttng_complete_sessions
+               return
+               ;;
        esac
 }
 
@@ -276,17 +256,6 @@ _lttng_cmd_version() {
        esac
 }
 
-_lttng_cmd_calibrate() {
-       local calibrate_opts
-       calibrate_opts=$(lttng calibrate --list-options)
-
-       case $cur in
-       -*)
-               COMPREPLY=( $(compgen -W "${calibrate_opts}" -- $cur) )
-               ;;
-       esac
-}
-
 _lttng_cmd_view() {
        local view_opts
                view_opts=$(lttng view --list-options)
This page took 0.029388 seconds and 5 git commands to generate.