View | Details | Raw Unified
Collapse All | Expand All

(-) _portage (-88 / +8 lines)
 Lines 114-132    Link Here 
_quickpkg () {
_quickpkg () {
	if compset -P '(\\|)(>=|<=|<|>|=)'; then
	if compset -P '(\\|)(>=|<=|<|>|=)'; then
	_arguments -s \
	_arguments -s \
    	    '*:installed package:_portage_unmerge_vers'
    	    '*:installed package:_gentoo_packages installed_versions'
	  elif compset -P '(\\|)[/]'; then
	  elif compset -P '(\\|)[/]'; then
		_path_files -W / -/
		_path_files -W / -/
	  else
	  else
    		_arguments \
    		_arguments \
		    '*:installed package:_portage_unmerge'
		    '*:installed package:_gentoo_packages installed'
	  fi
	  fi
}
}
# Stuff for emerge
# Stuff for emerge
_emerge () {
_emerge () {
    local state
    local nopkg_opts all noask_opts bopts install_args common_args profiles
    local nopkg_opts all noask_opts bopts install_args common_args profiles
  noask_opts=(-p -a --pretend --ask --regen --info --search -s --searchdesc \
  noask_opts=(-p -a --pretend --ask --regen --info --search -s --searchdesc \
 Lines 194-227    Link Here 
    'system[All packages in the system profile]'
    'system[All packages in the system profile]'
  )
  )
  #Reading informations from make.conf
  local trees portage_pkglist category var
  for var in PORTDIR PORTDIR_OVERLAY PKGDIR ; do
    local env_var=\$${var}
    [[ -z ${(e)env_var} && -r /etc/make.conf ]] && local $var="`. /etc/make.conf 2>/dev/null;
	echo ${(e)env_var}`"
    [[ -z ${(e)env_var} && -r /etc/make.globals ]] && local $var="`. /etc/make.globals 2>/dev/null;
	echo ${(e)env_var}`"
  done
  trees=( $PORTDIR $=PORTDIR_OVERLAY )
  portage_pkglist=( $trees/*-*/*(:t) )
  category=( $trees/*-*(/:t) )
  typeset -U category
  # Dispatch
  # Dispatch
  if (( $words[(I)(--(unmerge|clean|prune)|-[[:alpha:]]#(C|c|P)[[:alpha:]]#)] )) ; then
  if (( $words[(I)(--(unmerge|clean|prune)|-[[:alpha:]]#(C|c|P)[[:alpha:]]#)] )) ; then
	if compset -P '(\\|)(>=|<=|<|>|=)'; then
	if compset -P '(\\|)(>=|<=|<|>|=)'; then
	    _arguments -s \
	    _arguments -s \
		'*:installed package:_portage_unmerge_vers' && return 0
		'*:installed package:_gentoo_packages installed_versions' && return 0
	else
	else
	    _arguments -s \
	    _arguments -s \
		"$common_args[@]" "$install_args[@]" \
		"$common_args[@]" "$install_args[@]" \
		"*:installed package:_portage_unmerge" && return 0
		"*:installed package:_gentoo_packages installed" && return 0
	fi
	fi
  elif (( $words[(I)(world|system)] )) ; then
  elif (( $words[(I)(world|system)] )) ; then
 Lines 232-238    Link Here 
  elif (( $words[(I)(--usepkgonly|-[[:alnum:]]#K[[:alnum:]]#)] )) ; then
  elif (( $words[(I)(--usepkgonly|-[[:alnum:]]#K[[:alnum:]]#)] )) ; then
    _arguments -s \
    _arguments -s \
	"$common_args[@]" "$install_args[@]" \
	"$common_args[@]" "$install_args[@]" \
	'*:binary package:_portage_tbz2list' && return 0
	'*:binary package:_gentoo_packages binary' && return 0
  elif [[ $words[-3] == (--help|-h) ]] ; then
  elif [[ $words[-3] == (--help|-h) ]] ; then
      _message "No more arguments" && return 0
      _message "No more arguments" && return 0
 Lines 240-321    Link Here 
  else
  else
	if compset -P '(\\|)(>=|<=|<|>|=)'; then
	if compset -P '(\\|)(>=|<=|<|>|=)'; then
	    _arguments \
	    _arguments \
		"*:portage:_portage_pkglist_vers" && return 0
		"*:portage:_gentoo_packages available_versions" && return 0
	elif (( $words[(I)(--inject|-i)] )) ; then
	elif (( $words[(I)(--inject|-i)] )) ; then
	    _arguments -s \
	    _arguments -s \
		"$common_args[@]" "$install_args[@]" \
		"$common_args[@]" "$install_args[@]" \
		"*:portage:_portage_pkglist_vers" && return 0
		"*:portage:_gentoo_packages available_versions" && return 0
	else
	else
	    _arguments -s \
	    _arguments -s \
		"$common_args[@]" "$install_args[@]" \
		"$common_args[@]" "$install_args[@]" \
		"($nopkg_opts)::portage: _values 'profile' \$profiles[@] " \
		"($nopkg_opts)::portage: _values 'profile' \$profiles[@] " \
		"($nopkg_opts)*:portage:_portage_pkglist" && return 0
		"($nopkg_opts)*:portage:_gentoo_packages available" && return 0
	fi
	fi
  fi
  fi
}
}
#Function to show only installed packages   -- pkgname (no category or version #)
_portage_unmerge(){
    local installed_pkgname installed_list installed_portage
    installed_portage=(/var/db/pkg/*-*/*)
    installed_pkgname=( ${${installed_portage:t}%%-[0-9]*} )
    _tags installed_pkgname && compadd "$@" ${installed_pkgname}
    installed_list=( ${${installed_portage#*/pkg/}%%-[0-9]*} )
    _wanted packages expl 'category/package' _multi_parts "$@" / installed_list
}
#Function to show only installed packages -- cat/name-ver
_portage_unmerge_vers(){
    local installed_list installed_portage
    installed_portage=(/var/db/pkg/*-*/*)
    _tags installed_pkgname && compadd "$@" ${installed_portage:t}
    # most other cat/pkg don't work with _files, so I changed this one too.
    installed_list=( ${installed_portage##*/pkg/} )
    _wanted packages expl 'category/package' _multi_parts "$@" / installed_list
}
#Function to show tbz2 files available
_portage_tbz2list() {
    # this doesn't take care of ${PORTAGE_BINHOST}. If Gentoo official
    # binary mirror will be available we should rewrite it accordingly.
    _path_files -g \*.tbz2 -W "${PKGDIR}/All"
}
#Function to show all available portage names
_portage_pkglist(){
    local pkg
    _tags portage_pkglist && compadd "$@" $portage_pkglist
    # Complete cat/pkg. _multi_parts is much to slow for such a large task,
    # _sep_parts removes the dash from gnome-<tab>, and _path_files wants to
    # complete cat/pkg/files (if "files" is ignored with -F, miscfiles, etc...
    # don't get completed).
    if [[ $PREFIX != */* ]] ; then
	_wanted packages expl 'category/package' compadd -S '/' $category
    else
	compset -P '*/'
	pkg=( $trees/$IPREFIX/*(:t) )
	_wanted packages expl 'category/package' compadd $pkg
    fi
}
#Function to show all package versions
_portage_pkglist_vers(){
    local portage_ebuilds overlay_ebuilds pkg
    if [[  $#PREFIX -ge 1  &&  -z $words[(r)(--inject|-i)]  ]] ; then
	overlay_ebuilds=(${=PORTDIR_OVERLAY}/*-*/${PREFIX%%-[0-9]#*}*/*.ebuild(:t:r) )
	portage_ebuilds=($PORTDIR/metadata/cache/*-*/${PREFIX%%-[0-9]#*}*(:t))
	_tags portage_pkglist && compadd "$@" $portage_ebuilds $overlay_ebuilds
    fi
    pkg=( $trees/${PREFIX%%/*}/*/*.ebuild(:t:r) )
    _wanted packages expl 'category/package' _sep_parts category / pkg
}
local gentoo_runlevels
local gentoo_runlevels