docs/tools: Improve bash-completion template and generation

This allows us to generate templates also for arguments expecting
files (input, output) or PKCS#11 modules. The general ideal was
already implemented, but never completed.
This commit is contained in:
Jakub Jelen 2018-01-31 16:59:18 +01:00 committed by Frank Morgner
parent ccfd4b4c35
commit 1d49e8e0db
2 changed files with 13 additions and 2 deletions

View File

@ -36,8 +36,11 @@ tools.html: $(srcdir)/tools.xml $(wildcard $(srcdir)/*.1.xml) $(wildcard $(srcdi
$(shell sed -n 's,.*<option>\([^<]*\)</option>.*<replaceable>.*,\1,pg' $< \
| sort -u | grep -- '^\-' | tr '\n' '|' | sed 's,|$$,,')," \
| sed "s,FILEOPTS,\
$(shell sed -n 's,.*<option>\([^<]*\)</option>.*<replaceable>.*filename.*,\1,pg' $< \
| sort -u | grep -- '^\-' | tr '\n' '|')," \
$(shell sed -n 's,.*<option>\([^<]*\)</option>.*<replaceable>.*\(filename\|path\).*,\1,pg' $< \
| sort -u | grep -- '^\-' | tr '\n' '|' | sed 's,|$$,,' | grep ^ || echo "!*")," \
| sed "s,MODULEOPTS,\
$(shell sed -n 's,.*<option>\([^<]*\)</option>.*<replaceable>.*mod.*,\1,pg' $< \
| sort -u | grep -- '^\-' | tr '\n' '|' | sed 's,|$$,,' | grep ^ || echo "!*")," \
| sed "s,FUNCTION_NAME,$(shell echo $@ | sed s,-,_,g)," \
| sed "s,PROGRAM_NAME,$@," \
> $@

View File

@ -15,6 +15,14 @@ _FUNCTION_NAME()
fi
case "${prev}" in
MODULEOPTS)
_filedir so
return 0
;;
FILEOPTS)
_filedir
return 0
;;
OPTSWITHARGS)
return 0
;;