From 80ac799e534f7e330aa40596ee87986e56698d89 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 29 Feb 2024 10:48:33 +0100 Subject: [PATCH 1/4] 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 From 2be8ba02780680fa03c4bdd1c9efec75854b55f1 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 29 Feb 2024 18:07:47 +0100 Subject: [PATCH 2/4] Add zsh completion --- res/completions/arch-update.zsh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 res/completions/arch-update.zsh diff --git a/res/completions/arch-update.zsh b/res/completions/arch-update.zsh new file mode 100644 index 0000000..f7df2c4 --- /dev/null +++ b/res/completions/arch-update.zsh @@ -0,0 +1,11 @@ +#compdef arch-update + +local -a opts +opts=( + {-c,--check}'[Check for available updates]' + {-n,--news}'[Display latest Arch news]' + {-h,--help}'[Display the help message]' + {-V,--version}'[Display version information]' +) + +_arguments $opts From a46763aa3c47976493775274fe8cfe50896aea61 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 29 Feb 2024 20:39:19 +0100 Subject: [PATCH 3/4] Add fish completion --- res/completions/arch-update.fish | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 res/completions/arch-update.fish diff --git a/res/completions/arch-update.fish b/res/completions/arch-update.fish new file mode 100644 index 0000000..2aba1dd --- /dev/null +++ b/res/completions/arch-update.fish @@ -0,0 +1,6 @@ +complete -c arch-update -f + +complete -c arch-update -s c -l check -d 'Check for available updates' +complete -c arch-update -s n -l news -d 'Display latest Arch news' +complete -c arch-update -s h -l help -d 'Display the help message' +complete -c arch-update -s V -l version -d 'Display version information' From b6fb6a2b248d73e7d494231b603776bfdba1a1c7 Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Thu, 29 Feb 2024 20:56:19 +0100 Subject: [PATCH 4/4] Add shell completions to the Makefile --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 03f3496..199ef16 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,11 @@ uninstall: # Delete .mo files rm -f "${DESTDIR}${PREFIX}/usr/share/locale/fr/LC_MESSAGES/${_pkgname}.mo" + # Delete shell completions + rm -f "${DESTDIR}${PREFIX}/share/bash-completion/completions/${pkgname}" + rm -f "${DESTDIR}${PREFIX}/share/zsh/site-functions/_${pkgname}" + rm -f "${DESTDIR}${PREFIX}/share/fish/vendor_completions.d/${pkgname}.fish" + # Delete man pages rm -f "${DESTDIR}${PREFIX}/share/man/man1/${pkgname}.1.gz" rm -f "${DESTDIR}${PREFIX}/share/man/man5/${pkgname}.conf.5.gz"