From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Quentin Monnet <quentin@isovalent.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next 1/7] tools: bpftool: slightly ease bash completion updates
Date: Fri, 30 Jul 2021 14:54:58 -0700 [thread overview]
Message-ID: <CAEf4BzZiJ5MeBaEVcJF4mVvusCvAHmkwz+NF1xNc6fGUk7Zg6w@mail.gmail.com> (raw)
In-Reply-To: <b80ab3fb-dc70-5b7e-b86a-8b2b9bded54e@isovalent.com>
On Fri, Jul 30, 2021 at 2:47 PM Quentin Monnet <quentin@isovalent.com> wrote:
>
> 2021-07-30 11:45 UTC-0700 ~ Andrii Nakryiko <andrii.nakryiko@gmail.com>
> > On Thu, Jul 29, 2021 at 9:29 AM Quentin Monnet <quentin@isovalent.com> wrote:
> >>
> >> Bash completion for bpftool gets two minor improvements in this patch.
> >>
> >> Move the detection of attach types for "bpftool cgroup attach" outside
> >> of the "case/esac" bloc, where we cannot reuse our variable holding the
> >> list of supported attach types as a pattern list. After the change, we
> >> have only one list of cgroup attach types to update when new types are
> >> added, instead of the former two lists.
> >>
> >> Also rename the variables holding lists of names for program types, map
> >> types, and attach types, to make them more unique. This can make it
> >> slightly easier to point people to the relevant variables to update, but
> >> the main objective here is to help run a script to check that bash
> >> completion is up-to-date with bpftool's source code.
> >>
> >> Signed-off-by: Quentin Monnet <quentin@isovalent.com>
> >> ---
> >> tools/bpf/bpftool/bash-completion/bpftool | 57 +++++++++++++----------
> >> 1 file changed, 32 insertions(+), 25 deletions(-)
> >>
> >> diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool
> >> index cc33c5824a2f..b2e33a2d8524 100644
> >> --- a/tools/bpf/bpftool/bash-completion/bpftool
> >> +++ b/tools/bpf/bpftool/bash-completion/bpftool
> >> @@ -404,8 +404,10 @@ _bpftool()
> >> return 0
> >> ;;
> >> 5)
> >> - COMPREPLY=( $( compgen -W 'msg_verdict stream_verdict \
> >> - stream_parser flow_dissector' -- "$cur" ) )
> >> + local BPFTOOL_PROG_ATTACH_TYPES='msg_verdict \
> >> + stream_verdict stream_parser flow_dissector'
> >> + COMPREPLY=( $( compgen -W \
> >> + "$BPFTOOL_PROG_ATTACH_TYPES" -- "$cur" ) )
> >> return 0
> >> ;;
> >> 6)
> >> @@ -464,7 +466,7 @@ _bpftool()
> >>
> >> case $prev in
> >> type)
> >> - COMPREPLY=( $( compgen -W "socket kprobe \
> >> + local BPFTOOL_PROG_LOAD_TYPES='socket kprobe \
> >> kretprobe classifier flow_dissector \
> >> action tracepoint raw_tracepoint \
> >> xdp perf_event cgroup/skb cgroup/sock \
> >> @@ -479,8 +481,9 @@ _bpftool()
> >> cgroup/post_bind4 cgroup/post_bind6 \
> >> cgroup/sysctl cgroup/getsockopt \
> >> cgroup/setsockopt cgroup/sock_release struct_ops \
> >> - fentry fexit freplace sk_lookup" -- \
> >> - "$cur" ) )
> >> + fentry fexit freplace sk_lookup'
> >> + COMPREPLY=( $( compgen -W \
> >> + "$BPFTOOL_PROG_LOAD_TYPES" -- "$cur" ) )
> >
> > nit: this and similar COMPREPLY assignments now can be on a single line now, no?
>
> It will go over 80 characters, but OK, it will probably be more readable
> on a single line. I'll change for v2.
80 character rule was lifted a while ago. 100 is totally fine. And in
some special cases readability beats even 100, IMO.
next prev parent reply other threads:[~2021-07-30 21:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-29 16:29 [PATCH bpf-next 0/7] tools: bpftool: update, synchronise and Quentin Monnet
2021-07-29 16:29 ` [PATCH bpf-next 1/7] tools: bpftool: slightly ease bash completion updates Quentin Monnet
2021-07-30 18:45 ` Andrii Nakryiko
2021-07-30 21:46 ` Quentin Monnet
2021-07-30 21:54 ` Andrii Nakryiko [this message]
2021-07-29 16:29 ` [PATCH bpf-next 2/7] selftests/bpf: check consistency between bpftool source, doc, completion Quentin Monnet
2021-07-29 16:29 ` [PATCH bpf-next 3/7] tools: bpftool: complete and synchronise attach or map types Quentin Monnet
2021-07-30 18:52 ` Andrii Nakryiko
2021-07-30 21:47 ` Quentin Monnet
2021-07-29 16:29 ` [PATCH bpf-next 4/7] tools: bpftool: update and synchronise option list in doc and help msg Quentin Monnet
2021-07-29 16:29 ` [PATCH bpf-next 5/7] selftests/bpf: update bpftool's consistency script for checking options Quentin Monnet
2021-07-29 16:29 ` [PATCH bpf-next 6/7] tools: bpftool: document and add bash completion for -L, -B options Quentin Monnet
2021-07-30 18:59 ` Andrii Nakryiko
2021-07-30 21:48 ` Quentin Monnet
2021-07-30 22:10 ` Andrii Nakryiko
2021-07-29 16:29 ` [PATCH bpf-next 7/7] tools: bpftool: complete metrics list in "bpftool prog profile" doc Quentin Monnet
2021-07-30 19:06 ` [PATCH bpf-next 0/7] tools: bpftool: update, synchronise and Andrii Nakryiko
2021-07-30 21:48 ` Quentin Monnet
2021-07-30 21:58 ` Andrii Nakryiko
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=CAEf4BzZiJ5MeBaEVcJF4mVvusCvAHmkwz+NF1xNc6fGUk7Zg6w@mail.gmail.com \
--to=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=netdev@vger.kernel.org \
--cc=quentin@isovalent.com \
/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).