X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=extras%2Flttng-bash_completion;h=d5a58f38da5bc9b0e4d3bfef004a846e2fad91d2;hb=07bd66356a11f39a5e52d7150c30ce6ee7a9d993;hp=b515be08d484c9985e921556d9c313c0400d73e7;hpb=14c8c23f4a6cfd0c9758808bd1fcc6df6f6042d2;p=lttng-tools.git diff --git a/extras/lttng-bash_completion b/extras/lttng-bash_completion index b515be08d..d5a58f38d 100644 --- a/extras/lttng-bash_completion +++ b/extras/lttng-bash_completion @@ -16,11 +16,16 @@ # _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)