From: Tao Chen <chen.dylane@linux.dev>
To: Quentin Monnet <qmo@kernel.org>,
ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org,
yonghong.song@linux.dev, john.fastabend@gmail.com,
kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com,
jolsa@kernel.org, davem@davemloft.net, kuba@kernel.org,
hawk@kernel.org
Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 3/3] bpftool: Add bash completion for token argument
Date: Wed, 23 Jul 2025 00:35:48 +0800 [thread overview]
Message-ID: <5681662e-6038-433f-9da7-438b383621b7@linux.dev> (raw)
In-Reply-To: <ba84629f-5675-4793-9320-25d9029d2a35@kernel.org>
在 2025/7/22 23:02, Quentin Monnet 写道:
> 2025-07-22 20:09 UTC+0800 ~ Tao Chen <chen.dylane@linux.dev>
>> This commit updates the bash completion script with the new token
>> argument.
>> $ bpftool
>> batch cgroup gen iter map perf struct_ops
>> btf feature help link net prog token
>
>
> This is a terrible example, offering "token" as completion for just
> "bpftool [tab]" works without this patch :) The main commands are parsed
> from the output of "bpftool help" so it should work after your first
> patch. In this one, we add "list", "show" and "help" for completing
> "bpftool token [tab]".
>
As you said, how about this one? I will change it in v3, thanks.
$ bpftool token
help list show
>
>>
>> Signed-off-by: Tao Chen <chen.dylane@linux.dev>
>> ---
>> tools/bpf/bpftool/bash-completion/bpftool | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool
>> index a759ba24471..527bb47ac46 100644
>> --- a/tools/bpf/bpftool/bash-completion/bpftool
>> +++ b/tools/bpf/bpftool/bash-completion/bpftool
>> @@ -1215,6 +1215,17 @@ _bpftool()
>> ;;
>> esac
>> ;;
>> + token)
>> + case $command in
>> + show|list)
>> + return 0
>> + ;;
>> + *)
>> + [[ $prev == $object ]] && \
>> + COMPREPLY=( $( compgen -W 'help show list' -- "$cur" ) )
>> + ;;
>> + esac
>> + ;;
>> esac
>> } &&
>> complete -F _bpftool bpftool
>
>
> Other than the example in the description, this looks good.
>
> Reviewed-by: Quentin Monnet <qmo@kernel.org>
>
> Thanks
--
Best Regards
Tao Chen
next prev parent reply other threads:[~2025-07-22 16:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 12:09 [RESEND PATCH bpf-next v2 1/3] bpftool: Add bpf_token show Tao Chen
2025-07-22 12:09 ` [PATCH bpf-next v2 2/3] bpftool: Add bpftool-token manpage Tao Chen
2025-07-22 15:01 ` Quentin Monnet
2025-07-22 16:14 ` Tao Chen
2025-07-22 12:09 ` [PATCH bpf-next v2 3/3] bpftool: Add bash completion for token argument Tao Chen
2025-07-22 15:02 ` Quentin Monnet
2025-07-22 16:35 ` Tao Chen [this message]
2025-07-22 16:37 ` Quentin Monnet
-- strict thread matches above, loose matches on Subject: below --
2025-07-22 11:58 [PATCH bpf-next v2 1/3] bpftool: Add bpf_token show Tao Chen
2025-07-22 11:58 ` [PATCH bpf-next v2 3/3] bpftool: Add bash completion for token argument Tao Chen
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=5681662e-6038-433f-9da7-438b383621b7@linux.dev \
--to=chen.dylane@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=qmo@kernel.org \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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
all inboxes | Powered by JetHome®