From 80ac799e534f7e330aa40596ee87986e56698d89 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 29 Feb 2024 10:48:33 +0100 Subject: [PATCH] Add bash completion --- Makefile | 5 +++++ res/completions/arch-update.bash | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 res/completions/arch-update.bash diff --git a/Makefile b/Makefile index 733e0e7..03f3496 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,11 @@ install: install -Dm 644 po/fr.mo "${DESTDIR}${PREFIX}/share/locale/fr/LC_MESSAGES/${_pkgname}.mo" rm -f po/fr.mo + # Install shell completions + install -Dm 644 "res/completions/${pkgname}.bash" "${DESTDIR}${PREFIX}/share/bash-completion/completions/${pkgname}" + install -Dm 644 "res/completions/${pkgname}.zsh" "${DESTDIR}${PREFIX}/share/zsh/site-functions/_${pkgname}" + install -Dm 644 "res/completions/${pkgname}.fish" "${DESTDIR}${PREFIX}/share/fish/vendor_completions.d/${pkgname}.fish" + # Archive and install man pages gzip -c "doc/man/${pkgname}.1" > "doc/man/${pkgname}.1.gz" gzip -c "doc/man/${pkgname}.conf.5" > "doc/man/${pkgname}.conf.5.gz" diff --git a/res/completions/arch-update.bash b/res/completions/arch-update.bash new file mode 100644 index 0000000..812d63d --- /dev/null +++ b/res/completions/arch-update.bash @@ -0,0 +1,12 @@ +_arch-update() { + local arg="${2}" + local -a opts + opts=('-c --check + -n --news + -h --help + -V --version') + + COMPREPLY=( $(compgen -W "${opts[*]}" -- "${arg}") ) +} + +complete -F _arch-update arch-update