summaryrefslogtreecommitdiff
path: root/data/bash-completion.sh.in
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2018-12-18 11:58:52 -0500
committerCole Robinson <crobinso@redhat.com>2018-12-18 14:23:01 -0500
commit73f07c54ee68097aa982d0c06a683b3e8ce658de (patch)
tree57114d79e459ff1cc3519c6b7aad6892d03dfe6b /data/bash-completion.sh.in
parenta2850f345b9064bba6bf6856dc03c501d9de51da (diff)
downloadvirt-manager-73f07c54ee68097aa982d0c06a683b3e8ce658de.tar.gz
setup: Generate bashcompletion files in builddir
Diffstat (limited to 'data/bash-completion.sh.in')
-rw-r--r--data/bash-completion.sh.in37
1 files changed, 37 insertions, 0 deletions
diff --git a/data/bash-completion.sh.in b/data/bash-completion.sh.in
new file mode 100644
index 00000000..868c2b75
--- /dev/null
+++ b/data/bash-completion.sh.in
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+# 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() {
+ if [[ "$COMP_WORDBREAKS" != *,* ]]; then
+ COMP_WORDBREAKS="${COMP_WORDBREAKS},"
+ fi
+ local IFS=$'\013'
+ local SUPPRESS_SPACE=0
+ if compopt +o nospace 2> /dev/null; then
+ SUPPRESS_SPACE=1
+ fi
+ COMP_WORDS[4]=""
+ COMPREPLY=( $(IFS="$IFS" \
+ COMP_LINE="$COMP_LINE" \
+ COMP_POINT="$COMP_POINT" \
+ COMP_TYPE="$COMP_TYPE" \
+ _ARGCOMPLETE_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 ::SCRIPTNAME::