libutil: Implement zsh and bash autocompletion

Add functionality for generating autocompletion scripts,
allowing for tab completion of tool options for bash and zsh.

This functionality relies on reading the available options
from the util_opt struct at runtime.

The script generation happens on the build system.

Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Szabina Korbai <szkorbai@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
Szabina Korbai
2025-09-10 09:08:31 +01:00
committed by Steffen Eiden
parent 70157462d8
commit 638cbbe332
4 changed files with 407 additions and 2 deletions
+5 -2
View File
@@ -1,13 +1,16 @@
include ../common.mak
include ../common_autocomp.mak
lib := libutil.a
sources := $(filter-out %_example.c,$(wildcard *.c))
sources := $(filter-out %_example.c %_host.c, $(wildcard *.c))
objects := $(patsubst %.c,%.o,$(sources))
autocomp-object := util_autocomp_host.o
examples := $(patsubst %.c,%,$(wildcard *_example.c))
all: $(lib)
all: $(lib) $(autocomp-object)
examples: $(examples)
$(examples): %: %.o $(lib)