diff options
author | Andrii Nakryiko <andriin@fb.com> | 2019-04-25 18:30:10 -0400 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-04-26 00:45:14 -0400 |
commit | 4a714feefd99c25c7304b43ac58c9d5c0304e7cb (patch) | |
tree | 795d516fdf2ba765787130c1146d1162d1ec3b87 /tools/bpf/bpftool/bash-completion | |
parent | ca253339af928528ceb34770b076d3230ed7d629 (diff) |
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>
Diffstat (limited to 'tools/bpf/bpftool/bash-completion')
-rw-r--r-- | tools/bpf/bpftool/bash-completion/bpftool | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool index 9f3ffe1e26ab..bca91d04ed35 100644 --- a/tools/bpf/bpftool/bash-completion/bpftool +++ b/tools/bpf/bpftool/bash-completion/bpftool | |||
@@ -217,6 +217,7 @@ _bpftool() | |||
217 | done | 217 | done |
218 | cur=${words[cword]} | 218 | cur=${words[cword]} |
219 | prev=${words[cword - 1]} | 219 | prev=${words[cword - 1]} |
220 | pprev=${words[cword - 2]} | ||
220 | 221 | ||
221 | local object=${words[1]} command=${words[2]} | 222 | local object=${words[1]} command=${words[2]} |
222 | 223 | ||
@@ -607,6 +608,51 @@ _bpftool() | |||
607 | ;; | 608 | ;; |
608 | esac | 609 | esac |
609 | ;; | 610 | ;; |
611 | btf) | ||
612 | local PROG_TYPE='id pinned tag' | ||
613 | local MAP_TYPE='id pinned' | ||
614 | case $command in | ||
615 | dump) | ||
616 | case $prev in | ||
617 | $command) | ||
618 | COMPREPLY+=( $( compgen -W "id map prog file" -- \ | ||
619 | "$cur" ) ) | ||
620 | return 0 | ||
621 | ;; | ||
622 | prog) | ||
623 | COMPREPLY=( $( compgen -W "$PROG_TYPE" -- "$cur" ) ) | ||
624 | return 0 | ||
625 | ;; | ||
626 | map) | ||
627 | COMPREPLY=( $( compgen -W "$MAP_TYPE" -- "$cur" ) ) | ||
628 | return 0 | ||
629 | ;; | ||
630 | id) | ||
631 | case $pprev in | ||
632 | prog) | ||
633 | _bpftool_get_prog_ids | ||
634 | ;; | ||
635 | map) | ||
636 | _bpftool_get_map_ids | ||
637 | ;; | ||
638 | esac | ||
639 | return 0 | ||
640 | ;; | ||
641 | *) | ||
642 | if [[ $cword == 6 ]] && [[ ${words[3]} == "map" ]]; then | ||
643 | COMPREPLY+=( $( compgen -W 'key value kv all' -- \ | ||
644 | "$cur" ) ) | ||
645 | fi | ||
646 | return 0 | ||
647 | ;; | ||
648 | esac | ||
649 | ;; | ||
650 | *) | ||
651 | [[ $prev == $object ]] && \ | ||
652 | COMPREPLY=( $( compgen -W 'dump help' -- "$cur" ) ) | ||
653 | ;; | ||
654 | esac | ||
655 | ;; | ||
610 | cgroup) | 656 | cgroup) |
611 | case $command in | 657 | case $command in |
612 | show|list) | 658 | show|list) |