[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8372554b-0d4d-4f65-b000-a1a6c00d80ab@kernel.org>
Date: Fri, 13 Dec 2024 15:17:57 +0000
From: Quentin Monnet <qmo@...nel.org>
To: Daniel Xu <dxu@...uu.xyz>, andrii@...nel.org, ast@...nel.org,
daniel@...earbox.net
Cc: martin.lau@...ux.dev, eddyz87@...il.com, song@...nel.org,
yonghong.song@...ux.dev, john.fastabend@...il.com, kpsingh@...nel.org,
sdf@...ichev.me, haoluo@...gle.com, jolsa@...nel.org, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org, andrii.nakryiko@...il.com, antony@...nome.org,
toke@...nel.org
Subject: Re: [PATCH bpf-next v4 4/4] bpftool: bash: Add bash completion for
root_id argument
2024-12-12 18:24 UTC-0700 ~ Daniel Xu <dxu@...uu.xyz>
> This commit updates the bash completion script with the new root_id
> argument.
>
> Signed-off-by: Daniel Xu <dxu@...uu.xyz>
> ---
> tools/bpf/bpftool/bash-completion/bpftool | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool
> index 0c541498c301..097d406ee21f 100644
> --- a/tools/bpf/bpftool/bash-completion/bpftool
> +++ b/tools/bpf/bpftool/bash-completion/bpftool
> @@ -930,6 +930,9 @@ _bpftool()
> format)
> COMPREPLY=( $( compgen -W "c raw" -- "$cur" ) )
> ;;
> + root_id)
> + return 0;
> + ;;
> c)
> COMPREPLY=( $( compgen -W "unsorted" -- "$cur" ) )
> ;;
> @@ -937,13 +940,13 @@ _bpftool()
> # emit extra options
> case ${words[3]} in
> id|file)
> - _bpftool_once_attr 'format'
> + _bpftool_once_attr 'format root_id'
> ;;
> map|prog)
> if [[ ${words[3]} == "map" ]] && [[ $cword == 6 ]]; then
> COMPREPLY+=( $( compgen -W "key value kv all" -- "$cur" ) )
> fi
> - _bpftool_once_attr 'format'
> + _bpftool_once_attr 'format root_id'
> ;;
> *)
> ;;
Thanks! If we support multiple occurrences for root_id, let's adjust the
completion (and also complete with root_id after "format c", by the way,
I missed it last time):
------
diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool
index 0c541498c301..e5bf809656ed 100644
--- a/tools/bpf/bpftool/bash-completion/bpftool
+++ b/tools/bpf/bpftool/bash-completion/bpftool
@@ -930,19 +930,24 @@ _bpftool()
format)
COMPREPLY=( $( compgen -W "c raw" -- "$cur" ) )
;;
+ root_id)
+ return 0
+ ;;
c)
- COMPREPLY=( $( compgen -W "unsorted" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "unsorted root_id" -- "$cur" ) )
;;
*)
# emit extra options
case ${words[3]} in
id|file)
+ COMPREPLY=( $( compgen -W "root_id" -- "$cur" ) )
_bpftool_once_attr 'format'
;;
map|prog)
if [[ ${words[3]} == "map" ]] && [[ $cword == 6 ]]; then
COMPREPLY+=( $( compgen -W "key value kv all" -- "$cur" ) )
fi
+ COMPREPLY=( $( compgen -W "root_id" -- "$cur" ) )
_bpftool_once_attr 'format'
;;
*)
------
Powered by blists - more mailing lists