Commit 995231c8 authored by Quentin Monnet's avatar Quentin Monnet Committed by David S. Miller

tools: bpftool: add bash completion for bpftool

Add a completion file for bash. The completion function runs bpftool
when needed, making it smart enough to help users complete ids or tags
for eBPF programs and maps currently on the system.

Update Makefile to install completion file to
/usr/share/bash-completion/completions when running `make install`.

Emacs file mode and (at the end) Vim modeline have been added, to keep
the style in use for most existing bash completion files. In this, it
differs from tools/perf/perf-completion.sh, which seems to be the only
other completion file among the kernel sources repository. This is also
valid for indent style: 4-space indents, as in other completion files.
Signed-off-by: default avatarQuentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2660d226
...@@ -46,6 +46,7 @@ $(LIBBPF)-clean: ...@@ -46,6 +46,7 @@ $(LIBBPF)-clean:
$(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(OUTPUT) clean >/dev/null $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(OUTPUT) clean >/dev/null
prefix = /usr prefix = /usr
bash_compdir ?= $(prefix)/share/bash-completion/completions
CC = gcc CC = gcc
...@@ -76,6 +77,8 @@ clean: $(LIBBPF)-clean ...@@ -76,6 +77,8 @@ clean: $(LIBBPF)-clean
install: install:
install $(OUTPUT)bpftool $(prefix)/sbin/bpftool install $(OUTPUT)bpftool $(prefix)/sbin/bpftool
install -m 0755 -d $(bash_compdir)
install -m 0644 bash-completion/bpftool $(bash_compdir)
doc: doc:
$(Q)$(MAKE) -C Documentation/ $(Q)$(MAKE) -C Documentation/
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment