summaryrefslogtreecommitdiffstats
path: root/completions/_mock
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:14:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:14:42 +0000
commit0bc58b66a4850cdb8458a86c3d9a2fc81de82aa3 (patch)
treeea0fe36eb5e6f40e0a1f765d44c4b0c0b2bfb089 /completions/_mock
parentInitial commit. (diff)
downloadbash-completion-0bc58b66a4850cdb8458a86c3d9a2fc81de82aa3.tar.xz
bash-completion-0bc58b66a4850cdb8458a86c3d9a2fc81de82aa3.zip
Adding upstream version 1:2.11.upstream/1%2.11upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--completions/_mock69
1 files changed, 69 insertions, 0 deletions
diff --git a/completions/_mock b/completions/_mock
new file mode 100644
index 0000000..b468148
--- /dev/null
+++ b/completions/_mock
@@ -0,0 +1,69 @@
+# bash completion for mock -*- shell-script -*-
+
+# Use of this file is deprecated. Upstream completion is available in
+# mock > 1.1.0, use that instead.
+
+_mock()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ local plugins='tmpfs root_cache yum_cache bind_mount ccache'
+ local cfgdir=/etc/mock count=0 i
+
+ for i in "${words[@]}"; do
+ ((count == cword)) && break
+ if [[ $i == --configdir ]]; then
+ cfgdir="${words[count + 1]}"
+ elif [[ $i == --configdir=* ]]; then
+ cfgdir=${i/*=/}
+ fi
+ ((count++))
+ done
+
+ case $prev in
+ -h | --help | --copyin | --copyout | --arch | -D | --define | --with | --without | \
+ --uniqueext | --rpmbuild_timeout | --sources | --cwd)
+ return
+ ;;
+ -r | --root)
+ COMPREPLY=($(compgen -W "$(command ls $cfgdir)" -- "$cur"))
+ COMPREPLY=(${COMPREPLY[@]/%.cfg/})
+ return
+ ;;
+ --configdir | --resultdir)
+ _filedir -d
+ return
+ ;;
+ --spec)
+ _filedir spec
+ return
+ ;;
+ --target)
+ # Yep, compatible archs, not compatible build archs
+ # (e.g. ix86 chroot builds in x86_64 mock host)
+ # This would actually depend on what the target root
+ # can be used to build for...
+ COMPREPLY=($(compgen -W "$(command rpm --showrc |
+ command sed -ne 's/^\s*compatible\s\s*archs\s*:\s*\(.*\)/\1/i p')" \
+ -- "$cur"))
+ return
+ ;;
+ --enable-plugin | --disable-plugin)
+ COMPREPLY=($(compgen -W "$plugins" -- "$cur"))
+ return
+ ;;
+ esac
+
+ $split && return
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
+ [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
+ else
+ _filedir '@(?(no)src.r|s)pm'
+ fi
+} &&
+ complete -F _mock mock
+
+# ex: filetype=sh