From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: [PATCH] trace-cmd: Fix bash completions for non specified commands
Date: Wed, 23 Mar 2022 22:50:16 -0400 [thread overview]
Message-ID: <20220323225016.3a3a7034@gandalf.local.home> (raw)
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
For trace-cmd commands that are not specifically specified by the bash
completion script, allow to see files after the commands. There's a bug in
the test that returns if there are options, and does not jump to the file
listing if there is any option even if the user does not specify one, and
wants a file instead.
Also make a reference to $cur more consistent with its other references,
which is ${cur}
Fixes: 431f1a03f59cb trace-cmd: Fix bash completion on directory names
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
tracecmd/trace-cmd.bash | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tracecmd/trace-cmd.bash b/tracecmd/trace-cmd.bash
index 6639c1433678..66bd6f4bf2dd 100644
--- a/tracecmd/trace-cmd.bash
+++ b/tracecmd/trace-cmd.bash
@@ -52,7 +52,7 @@ cmd_options()
sed -e 's/ *\(-[^ ]*\).*/\1/')
COMPREPLY=( $(compgen -W "${cmds}" -- "${cur}") )
if [ ${#COMPREPLY[@]} -eq 0 ]; then
- __show_files "$cur"
+ __show_files "${cur}"
fi
}
@@ -276,10 +276,12 @@ __show_command_options()
done
fi
COMPREPLY=( $(compgen -W "${opts}" -- "$cur"))
- return 0
+ break
fi
done
- __show_files "$cur"
+ if [ ${#COMPREPLY[@]} -eq 0 ]; then
+ __show_files "${cur}"
+ fi
}
_trace_cmd_complete()
--
2.35.1
reply other threads:[~2022-03-24 2:50 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=20220323225016.3a3a7034@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).