From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: [PATCH] trace-cmd list: Show events in bash completion
Date: Tue, 8 Apr 2025 11:37:04 -0400 [thread overview]
Message-ID: <20250408113704.42fb24c8@gandalf.local.home> (raw)
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
Even though trace-cmd list -e shows the events, there's several times where
it is useful to see a format of an event that is known, and having tab
completion for those events would be useful.
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
tracecmd/trace-cmd.bash | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tracecmd/trace-cmd.bash b/tracecmd/trace-cmd.bash
index d7816bcf..ee7c79a2 100644
--- a/tracecmd/trace-cmd.bash
+++ b/tracecmd/trace-cmd.bash
@@ -84,6 +84,12 @@ __trace_cmd_list_complete()
sed -e 's/.*\(-.\).*/\1/')
COMPREPLY=( $(compgen -W "${cmds}" -- "${cur}") )
;;
+ -e)
+ local list=$(trace-cmd list -e "$cur")
+ 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 "all ${events} ${systems}" -- "${cur}") )
+ ;;
*)
size=${#words[@]}
if [ $size -gt 3 ]; then
--
2.47.2
reply other threads:[~2025-04-08 15:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250408113704.42fb24c8@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).