1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- [ -z "$BASH_VERSION" ] && return
- _filedir()
- {
- local IFS=$'\t\n' xspec #glob
- #glob=$(set +o|grep noglob) # save glob setting.
- #set -f # disable pathname expansion (globbing)
- xspec=${1:+"!*.$1"} # set only if glob passed in as $1
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -f -X "$xspec" -- "$cur" ) \
- $( compgen -d -- "$cur" ) )
- #eval "$glob" # restore glob setting.
- }
- _vbuilder()
- {
- local opts cur prev first
- COMPREPLY=()
- cur="${COMP_WORDS[COMP_CWORD]}"
- prev="${COMP_WORDS[COMP_CWORD-1]}"
- first="${COMP_WORDS[1]}"
- ## The basic options we'll complete.
- options="--version --arch --category --dist-upgrade --unionfs --target --with-compat32 --rpmbuild-define --rpmbuild-with --rpmbuild-without --sign --no-install --login --bootstrap-dir --unionfs-dir --cache-dir --built-rpms-dir --debug"
- actions="clean build build-rpm install-rpm remove-rpm"
- opts="$options $actions"
- _arch=$(rpm --eval %_arch)
- ## Complete the arguments to some of the basic commands.
- case "${prev}" in
- --version)
- local running="VineSeed 6.0 5.2 4.2"
- COMPREPLY=( $(compgen -W "${running}" -- "${cur}") )
- ;;
- --arch)
- local running="i386 ppc x86_64 arm"
- COMPREPLY=( $(compgen -W "${running}" -- "${cur}") )
- ;;
- --category)
- local running="main proposed-updates,main plus,main nonfree,plus,main test,nonfree,plus,main test,plus,main test,main"
- COMPREPLY=( $(compgen -W "${running}" -- "${cur}") )
- ;;
- --target)
- local running="$(cat /usr/lib/rpm/rpmrc | grep arch_canon: | sed -e "s/arch_canon:[[:blank:]]*\(.*\):.*/\1/") noarch"
- COMPREPLY=( $(compgen -W "${running}" -- "${cur}") )
- ;;
- --bootstrap-dir|--unionfs-dir|--cache-dir|--built-rpms-dir)
- if [ $COMP_CWORD -eq 1 -o "${COMPREPLY+set}" != "set" ]; then
- _filedir ''
- fi
- ;;
- 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}"))
- #return 0
- ;;
- esac
- if [[ "${cur}" == -* ]] ; then
- COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
- #return 0
- fi
- }
- complete -o filenames -o nospace -F _vbuilder vbuilder
- ### end of file
|