Lines 1619-1698
Link Here
|
1619 |
fi |
1619 |
fi |
1620 |
|
1620 |
|
1621 |
# find action |
1621 |
# find action |
1622 |
for x in ${COMP_LINE} ; do |
1622 |
for ((i = 0; i < ${numwords}; i++ )); do |
1623 |
if [[ ${x} =~ --(exact|help|ignore|keep-temp|library|nocolor|no-ld-path|no-order|no-progress|no-util|pretend|quiet|verbose) ]] || \ |
1623 |
case ${COMP_WORDS[${i}]} in |
1624 |
[[ ${x} =~ -(e|h|i|k|L|l|o|p|P|q|u|v) ]] |
1624 |
--library|-L) |
1625 |
then |
1625 |
action=${COMP_WORDS[${i}]} |
1626 |
action=${x} |
|
|
1627 |
break |
1628 |
fi |
1629 |
done |
1630 |
if [[ -n ${action} ]]; then |
1631 |
for ((i = 0; i < ${numwords}; i++ )); do |
1632 |
if [[ ${COMP_WORDS[${i}]} == "${action}" ]]; then |
1633 |
actionpos=${i} |
1626 |
actionpos=${i} |
1634 |
break |
1627 |
;; |
1635 |
fi |
1628 |
--help|-h) |
1636 |
done |
1629 |
action=${COMP_WORDS[${i}]} |
1637 |
|
1630 |
actionpos=${i} |
1638 |
for ((i = 1; i < ${numwords}; i++ )); do |
1631 |
;; |
1639 |
if [[ ! ${COMP_WORDS[$i]} == -* ]]; then |
1632 |
esac |
1640 |
break |
1633 |
done |
1641 |
fi |
|
|
1642 |
done |
1643 |
fi |
1644 |
|
1634 |
|
1645 |
|
|
|
1646 |
if [[ ${cur} == -* ]]; then |
1635 |
if [[ ${cur} == -* ]]; then |
1647 |
if [[ ${cur} == --* ]]; then |
1636 |
if [[ ${cur} == --* ]]; then |
1648 |
opts="--exact --help --ignore --keep-temp --library --nocolor --no-ld-path --no-order --no-progress --no-util --pretend --quiet --verbose" |
1637 |
opts="--exact --help --ignore --keep-temp --library --nocolor --no-ld-path --no-order --no-progress --no-util --pretend --quiet --verbose" |
1649 |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) |
1638 |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) |
1650 |
return 0 |
1639 |
else |
1651 |
elif [[ ${cur} == -* ]]; then |
|
|
1652 |
opts="-e -h -i -k -L -l -o -p -P -q -u -v" |
1640 |
opts="-e -h -i -k -L -l -o -p -P -q -u -v" |
1653 |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) |
1641 |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) |
1654 |
return 0 |
|
|
1655 |
fi |
1642 |
fi |
1656 |
|
1643 |
return 0 |
1657 |
|
|
|
1658 |
# NOTE: This slows things down! |
1659 |
# (Adapted from bash_completion by Ian Macdonald <ian@caliban.org>) |
1660 |
# This removes any options from the list of completions that have |
1661 |
# already been specified on the command line. |
1662 |
COMPREPLY=($(echo "${COMP_WORDS[@]}" | \ |
1663 |
(while read -d ' ' i; do |
1664 |
[[ -z ${i} ]] && continue |
1665 |
# flatten array with spaces on either side, |
1666 |
# otherwise we cannot grep on word boundaries of |
1667 |
# first and last word |
1668 |
COMPREPLY=" ${COMPREPLY[@]} " |
1669 |
# remove word from list of completions |
1670 |
COMPREPLY=(${COMPREPLY/ ${i%% *} / }) |
1671 |
done |
1672 |
echo ${COMPREPLY[@]}))) |
1673 |
|
1674 |
return 0 |
1675 |
fi |
1644 |
fi |
1676 |
if [[ ${action} == '--library' ]] || [[ ${action} == '-L' ]] ; then |
1645 |
if [[ ${action} == '--library' ]] || [[ ${action} == '-L' ]] ; then |
1677 |
if [[ "${cur}" == */* ]]; then |
1646 |
if [[ "${cur}" == */* ]]; then |
1678 |
words=$(builtin cd @GENTOO_PORTAGE_EPREFIX@/lib; compgen -G "${cur}*") |
1647 |
COMPREPLY=( $(builtin cd @GENTOO_PORTAGE_EPREFIX@/lib; compgen -f -- "${cur}") ) |
1679 |
else |
1648 |
else |
1680 |
words=$(builtin cd @GENTOO_PORTAGE_EPREFIX@/lib; compgen -X '/' -G "${cur}*") |
1649 |
COMPREPLY=( $(builtin cd @GENTOO_PORTAGE_EPREFIX@/lib; compgen -X '/' -f -- "${cur}") ) |
1681 |
local n=0 |
|
|
1682 |
for i in ${words} ; do |
1683 |
[[ ${i} == ${cur}* ]] && n=$((n+1)) |
1684 |
done |
1685 |
|
1686 |
if [[ ${n} -eq 1 ]] ; then |
1687 |
words="$(builtin cd @GENTOO_PORTAGE_EPREFIX@/lib ; compgen -G "*-*/*")" |
1688 |
fi |
1689 |
fi |
1650 |
fi |
1690 |
COMPREPLY=($(for i in ${words} ; do \ |
|
|
1691 |
[[ ${i} == ${cur}* ]] && echo ${i} ; \ |
1692 |
done)) |
1693 |
return 0 |
1694 |
fi |
1651 |
fi |
1695 |
return 0 |
1652 |
return 0 |
1696 |
} |
1653 |
} |
1697 |
complete -F _revdep_rebuild revdep-rebuild |
1654 |
complete -F _revdep_rebuild revdep-rebuild |
1698 |
} |
1655 |
} |