|
@@ -0,0 +1,81 @@
|
|
|
+[ -z "$BASH_VERSION" ] && return
|
|
|
+
|
|
|
+_filedir()
|
|
|
+{
|
|
|
+ local IFS=$'\t\n' xspec
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ xspec=${1:+"!*.$1"}
|
|
|
+ COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -f -X "$xspec" -- "$cur" ) \
|
|
|
+ $( compgen -d -- "$cur" ) )
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+_vbuilder()
|
|
|
+{
|
|
|
+ local opts cur prev first
|
|
|
+ COMPREPLY=()
|
|
|
+ cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
|
+ first="${COMP_WORDS[1]}"
|
|
|
+
|
|
|
+
|
|
|
+ options="--version --arch --dist-upgrade --target --with-compat32"
|
|
|
+ actions="--clean --build --build-rpm --install-rpm --remove-rpm"
|
|
|
+ opts="$options $actions"
|
|
|
+
|
|
|
+ _arch=$(rpm --eval %_arch)
|
|
|
+
|
|
|
+ in_options=0
|
|
|
+
|
|
|
+
|
|
|
+ case "${prev}" in
|
|
|
+ --version)
|
|
|
+ if [ "$_arch" = "x86_64" ]; then
|
|
|
+ local running="VineSeed VineSeed_i386 5.0 5.0_i386 4.2_i386"
|
|
|
+ else
|
|
|
+ local running="VineSeed 5.0 4.2"
|
|
|
+ fi
|
|
|
+ COMPREPLY=( $(compgen -W "${running}" -- "${cur}") )
|
|
|
+ ;;
|
|
|
+
|
|
|
+ --arch)
|
|
|
+ local running="i386 ppc x86_64"
|
|
|
+ COMPREPLY=( $(compgen -W "${running}" -- "${cur}") )
|
|
|
+ ;;
|
|
|
+
|
|
|
+ --target)
|
|
|
+ local running="$(cat /usr/lib/rpm/rpmrc | grep arch_canon: | sed -e "s/arch_canon:[[:blank:]]*\(.*\):.*/\1/")"
|
|
|
+ COMPREPLY=( $(compgen -W "${running}" -- "${cur}") )
|
|
|
+ ;;
|
|
|
+
|
|
|
+ --build-rpm)
|
|
|
+ if [ $COMP_CWORD -eq 1 -o "${COMPREPLY+set}" != "set" ]; then
|
|
|
+ _filedir 'src.rpm'
|
|
|
+ fi
|
|
|
+ ;;
|
|
|
+
|
|
|
+ --install-rpm|--remove-rpm)
|
|
|
+ if [ $COMP_CWORD -eq 1 -o "${COMPREPLY+set}" != "set" ]; then
|
|
|
+ _filedir 'rpm'
|
|
|
+ fi
|
|
|
+ ;;
|
|
|
+
|
|
|
+ *)
|
|
|
+ COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
|
|
|
+
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+
|
|
|
+ if [[ "${cur}" == -* ]] ; then
|
|
|
+ COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
|
|
|
+
|
|
|
+ fi
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+complete -o filenames -o nospace -F _vbuilder vbuilder
|
|
|
+
|
|
|
+
|