summarylogtreecommitdiffstats
path: root/completion
diff options
context:
space:
mode:
authorDmytro Kostiuchenko2018-06-16 17:06:08 -0400
committerDmytro Kostiuchenko2018-06-16 17:10:03 -0400
commit00be7692a261044d456f4acc74448f4b109c7d16 (patch)
treea20f2d4226610cdff86683198c9270e39b2de94a /completion
parent5fa71727dea188a5d75197237318fc517cb1dcb4 (diff)
downloadaur-00be7692a261044d456f4acc74448f4b109c7d16.tar.gz
Add bash completion to PKGBUILD
Diffstat (limited to 'completion')
-rw-r--r--completion34
1 files changed, 34 insertions, 0 deletions
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"
+