aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bpf/bpftool/bash-completion
diff options
context:
space:
mode:
authorQuentin Monnet <quentin.monnet@netronome.com>2018-03-01 21:01:23 -0500
committerAlexei Starovoitov <ast@kernel.org>2018-03-01 21:29:49 -0500
commitd96fc832bcb6269d96e33d506f33033d7ed08598 (patch)
treec9d40bc77d803eeea1d26b3e8a6c78467606a704 /tools/bpf/bpftool/bash-completion
parentb6c1cedb4935a99d315827b990b23230b0eb13f5 (diff)
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 'tools/bpf/bpftool/bash-completion')
-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()
147 147
148 # Deal with simplest keywords 148 # Deal with simplest keywords
149 case $prev in 149 case $prev in
150 help|key|opcodes) 150 help|key|opcodes|visual)
151 return 0 151 return 0
152 ;; 152 ;;
153 tag) 153 tag)
@@ -223,11 +223,16 @@ _bpftool()
223 return 0 223 return 0
224 ;; 224 ;;
225 *) 225 *)
226 _bpftool_once_attr 'file' 226 _bpftool_once_attr 'file'
227 if _bpftool_search_list 'xlated'; then
228 COMPREPLY+=( $( compgen -W 'opcodes visual' -- \
229 "$cur" ) )
230 else
227 COMPREPLY+=( $( compgen -W 'opcodes' -- \ 231 COMPREPLY+=( $( compgen -W 'opcodes' -- \
228 "$cur" ) ) 232 "$cur" ) )
229 return 0 233 fi
230 ;; 234 return 0
235 ;;
231 esac 236 esac
232 ;; 237 ;;
233 pin) 238 pin)