mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-06 04:33:58 +08:00
bpftool: add bash completions for btf command
Add full support for btf command in bash-completion script. Cc: Quentin Monnet <quentin.monnet@netronome.com> Cc: Yonghong Song <yhs@fb.com> Cc: Alexei Starovoitov <ast@fb.com> Cc: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
ca253339af
commit
4a714feefd
@ -217,6 +217,7 @@ _bpftool()
|
|||||||
done
|
done
|
||||||
cur=${words[cword]}
|
cur=${words[cword]}
|
||||||
prev=${words[cword - 1]}
|
prev=${words[cword - 1]}
|
||||||
|
pprev=${words[cword - 2]}
|
||||||
|
|
||||||
local object=${words[1]} command=${words[2]}
|
local object=${words[1]} command=${words[2]}
|
||||||
|
|
||||||
@ -607,6 +608,51 @@ _bpftool()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
btf)
|
||||||
|
local PROG_TYPE='id pinned tag'
|
||||||
|
local MAP_TYPE='id pinned'
|
||||||
|
case $command in
|
||||||
|
dump)
|
||||||
|
case $prev in
|
||||||
|
$command)
|
||||||
|
COMPREPLY+=( $( compgen -W "id map prog file" -- \
|
||||||
|
"$cur" ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
prog)
|
||||||
|
COMPREPLY=( $( compgen -W "$PROG_TYPE" -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
map)
|
||||||
|
COMPREPLY=( $( compgen -W "$MAP_TYPE" -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
id)
|
||||||
|
case $pprev in
|
||||||
|
prog)
|
||||||
|
_bpftool_get_prog_ids
|
||||||
|
;;
|
||||||
|
map)
|
||||||
|
_bpftool_get_map_ids
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [[ $cword == 6 ]] && [[ ${words[3]} == "map" ]]; then
|
||||||
|
COMPREPLY+=( $( compgen -W 'key value kv all' -- \
|
||||||
|
"$cur" ) )
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
[[ $prev == $object ]] && \
|
||||||
|
COMPREPLY=( $( compgen -W 'dump help' -- "$cur" ) )
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
cgroup)
|
cgroup)
|
||||||
case $command in
|
case $command in
|
||||||
show|list)
|
show|list)
|
||||||
|
Loading…
Reference in New Issue
Block a user