diff options
author | Dmytro Kostiuchenko | 2018-06-16 17:06:08 -0400 |
---|---|---|
committer | Dmytro Kostiuchenko | 2018-06-16 17:10:03 -0400 |
commit | 00be7692a261044d456f4acc74448f4b109c7d16 (patch) | |
tree | a20f2d4226610cdff86683198c9270e39b2de94a | |
parent | 5fa71727dea188a5d75197237318fc517cb1dcb4 (diff) | |
download | aur-00be7692a261044d456f4acc74448f4b109c7d16.tar.gz |
Add bash completion to PKGBUILD
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | PKGBUILD | 15 | ||||
-rw-r--r-- | completion | 34 |
3 files changed, 46 insertions, 5 deletions
@@ -14,7 +14,9 @@ pkgbase = randrctl-git provides = randrctl conflicts = randrctl source = git+https://github.com/edio/randrctl.git + source = completion md5sums = SKIP + md5sums = 0557733f74c7724ac0680e6166807b83 pkgname = randrctl-git @@ -11,8 +11,14 @@ license=('GPLv3') makedepends=('git' 'python-pip') depends=('python' 'xorg-xrandr') optdepends=('bash-completion') -source=('git+https://github.com/edio/randrctl.git') -md5sums=('SKIP') +source=( + 'git+https://github.com/edio/randrctl.git' + 'completion' +) +md5sums=( + 'SKIP' + '0557733f74c7724ac0680e6166807b83' +) provides=("$_gitname") conflicts=("$_gitname") install="randrctl.install" @@ -28,9 +34,8 @@ package() { # PKGBUILD handles setup python setup.py install --root="$pkgdir/" --optimize=1 - $pkgdir/usr/bin/randrctl setup completion > completion - install -Dm644 completion "$pkgdir/usr/share/bash-completion/completions/randrctl" - install -Dm644 randrctl/misc/udev/99-randrctl.rules "$pkgdir/usr/lib/udev/rules.d/99-randrctl.rules" + install -Dm644 "$srcdir/completion" "$pkgdir/usr/share/bash-completion/completions/randrctl" + install -Dm644 "randrctl/misc/udev/99-randrctl.rules" "$pkgdir/usr/lib/udev/rules.d/99-randrctl.rules" } # vim:set ts=2 sw=2 et: diff --git a/completion b/completion new file mode 100644 index 000000000000..716ad3d9270d --- /dev/null +++ b/completion @@ -0,0 +1,34 @@ +completion + +# Run something, muting output or redirecting it to the debug stream +# depending on the value of _ARC_DEBUG. +__python_argcomplete_run() { + if [[ -z "$_ARC_DEBUG" ]]; then + "$@" 8>&1 9>&2 1>/dev/null 2>&1 + else + "$@" 8>&1 9>&2 1>&9 2>&1 + fi +} + +_python_argcomplete() { + local IFS=$'\013' + local SUPPRESS_SPACE=0 + if compopt +o nospace 2> /dev/null; then + SUPPRESS_SPACE=1 + fi + COMPREPLY=( $(IFS="$IFS" \ + COMP_LINE="$COMP_LINE" \ + COMP_POINT="$COMP_POINT" \ + COMP_TYPE="$COMP_TYPE" \ + _ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS" \ + _ARGCOMPLETE=1 \ + _ARGCOMPLETE_SUPPRESS_SPACE=$SUPPRESS_SPACE \ + __python_argcomplete_run "$1") ) + if [[ $? != 0 ]]; then + unset COMPREPLY + elif [[ $SUPPRESS_SPACE == 1 ]] && [[ "$COMPREPLY" =~ [=/:]$ ]]; then + compopt -o nospace + fi +} +complete -o nospace -o default -F _python_argcomplete "randrctl" + |