From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx> Update the tab completion to find events instead of needing to know the systems. Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> --- tracecmd/trace-cmd.bash | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tracecmd/trace-cmd.bash b/tracecmd/trace-cmd.bash index e89c1a55..9b0703b7 100644 --- a/tracecmd/trace-cmd.bash +++ b/tracecmd/trace-cmd.bash @@ -142,10 +142,16 @@ __trace_cmd_record_complete() case "$prev" in -e) - local events=$(trace-cmd list -e) + local list=$(trace-cmd list -e "$cur") local prefix=${cur%%:*} + if [ -z "$cur" -o "$cur" != "$prefix" ]; then + COMPREPLY=( $(compgen -W "all ${list}" -- "${cur}") ) + else + local events=$(for e in $list; do echo ${e/*:/}; done | sort -u) + local systems=$(for s in $list; do echo ${s/:*/:}; done | sort -u) - COMPREPLY=( $(compgen -W "${events}" -- "${cur}") ) + COMPREPLY=( $(compgen -W "all ${events} ${systems}" -- "${cur}") ) + fi # This is still to handle the "*:*" special case if [[ -n "$prefix" ]]; then -- 2.29.2