12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- [ -z "$BASH_VERSION" ] && return
- _vbootstrap_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.
- } # _vbootstrap_filedir()
- _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="--profile --version --arch --category --fetch-url --dist-upgrade --unionfs --target --no-build-essential --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
- --profile)
- local running=$(ls /etc/vbootstrap/profile.d/*.conf | sed -e "s|/etc/vbootstrap/profile.d/||g" -e "s|\.conf||g")
- COMPREPLY=( $(compgen -W "${running}" -- "${cur}") )
- ;;
- --version)
- local running="VineSeed 6.5 6 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
- _vbootstrap_filedir ''
- fi
- ;;
- build-rpm)
- if [ $COMP_CWORD -eq 1 -o "${COMPREPLY+set}" != "set" ]; then
- _vbootstrap_filedir 'src.rpm'
- fi
- ;;
- install-rpm|remove-rpm)
- if [ $COMP_CWORD -eq 1 -o "${COMPREPLY+set}" != "set" ]; then
- _vbootstrap_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
|