aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2017-05-09 16:31:44 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2017-05-09 16:31:44 -0400
commit26b2695217bd820da3c1be4301b4de6fea2bbdbb (patch)
tree6b31dc2cba15e444dcc0eee187e8ddcef1688a75
parent3255cd93dd46fee8f106a6556b1114f773085a2f (diff)
downloadtrace-cmd-26b2695217bd820da3c1be4301b4de6fea2bbdbb.tar.gz
trace-cmd: Add bash completion for trace-cmd report -O
Show the available options with the bash completion of trace-cmd report -O Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r--trace-cmd.bash29
1 files changed, 29 insertions, 0 deletions
diff --git a/trace-cmd.bash b/trace-cmd.bash
index 1613c170..048537e7 100644
--- a/trace-cmd.bash
+++ b/trace-cmd.bash
@@ -19,6 +19,14 @@ cmd_options()
COMPREPLY=( $(compgen $flags -W "${cmds}" -- "${cur}") )
}
+plugin_options()
+{
+ local cur="$1"
+
+ local opts=$(trace-cmd list -O | sed -ne 's/option://p')
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+}
+
__trace_cmd_list_complete()
{
local prev=$1
@@ -129,6 +137,23 @@ __trace_cmd_record_complete()
esac
}
+__trace_cmd_report_complete()
+{
+ local prev=$1
+ local cur=$2
+ shift 2
+ local words=("$@")
+
+ case "$prev" in
+ -O)
+ plugin_options "$cur"
+ ;;
+ *)
+ cmd_options report "$cur" -f
+ ;;
+ esac
+}
+
__show_command_options()
{
local command="$1"
@@ -201,6 +226,10 @@ _trace_cmd_complete()
__trace_cmd_record_complete "${prev}" "${cur}" ${words[@]}
return 0
;;
+ report)
+ __trace_cmd_report_complete "${prev}" "${cur}" ${words[@]}
+ return 0
+ ;;
*)
__show_command_options "$w" "${cur}"
;;