aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bpf/bpftool/bash-completion/bpftool
diff options
context:
space:
mode:
authorQuentin Monnet <quentin.monnet@netronome.com>2018-03-01 18:01:23 -0800
committerAlexei Starovoitov <ast@kernel.org>2018-03-01 18:29:49 -0800
commitd96fc832bcb6269d96e33d506f33033d7ed08598 (patch)
treec9d40bc77d803eeea1d26b3e8a6c78467606a704 /tools/bpf/bpftool/bash-completion/bpftool
parenttools: bpftool: new command-line option and documentation for 'visual' (diff)
downloadlinux-dev-d96fc832bcb6269d96e33d506f33033d7ed08598.tar.xz
linux-dev-d96fc832bcb6269d96e33d506f33033d7ed08598.zip
tools: bpftool: add bash completion for CFG dump
Add bash completion for the "visual" keyword used for dumping the CFG of eBPF programs with bpftool. Make sure we only complete with this keyword when we dump "xlated" (and not "jited") instructions. Acked-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to '')
-rw-r--r--tools/bpf/bpftool/bash-completion/bpftool13
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool
index 08719c54a614..490811b45fa7 100644
--- a/tools/bpf/bpftool/bash-completion/bpftool
+++ b/tools/bpf/bpftool/bash-completion/bpftool
@@ -147,7 +147,7 @@ _bpftool()
# Deal with simplest keywords
case $prev in
- help|key|opcodes)
+ help|key|opcodes|visual)
return 0
;;
tag)
@@ -223,11 +223,16 @@ _bpftool()
return 0
;;
*)
- _bpftool_once_attr 'file'
+ _bpftool_once_attr 'file'
+ if _bpftool_search_list 'xlated'; then
+ COMPREPLY+=( $( compgen -W 'opcodes visual' -- \
+ "$cur" ) )
+ else
COMPREPLY+=( $( compgen -W 'opcodes' -- \
"$cur" ) )
- return 0
- ;;
+ fi
+ return 0
+ ;;
esac
;;
pin)