summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Rousse <guillomovitch@mandriva.org>2008-03-18 20:16:16 +0000
committerGuillaume Rousse <guillomovitch@mandriva.org>2008-03-18 20:16:16 +0000
commit0dfc8d0400785478e4b37ce2a690ebf431c4d765 (patch)
treed1498fe2221690fb97ae00008fd514af8f1df4eb
parent743a7fa26662c92463673547df95e6171d2da1d6 (diff)
downloadurpmi-0dfc8d0400785478e4b37ce2a690ebf431c4d765.tar
urpmi-0dfc8d0400785478e4b37ce2a690ebf431c4d765.tar.gz
urpmi-0dfc8d0400785478e4b37ce2a690ebf431c4d765.tar.bz2
urpmi-0dfc8d0400785478e4b37ce2a690ebf431c4d765.tar.xz
urpmi-0dfc8d0400785478e4b37ce2a690ebf431c4d765.zip
don't complete on available packages if completed item is clearly a file
only select available packages for selected medias fix rurpmi completion
-rw-r--r--urpmi.bash-completion31
1 files changed, 29 insertions, 2 deletions
diff --git a/urpmi.bash-completion b/urpmi.bash-completion
index fe9921ab..bd4dc597 100644
--- a/urpmi.bash-completion
+++ b/urpmi.bash-completion
@@ -26,6 +26,26 @@ _urpmi_aliases()
COMPREPLY=( $( awk -F: '{print $1}' /etc/urpmi/parallel.cfg 2>/dev/null | grep "^${cur//\\\\/}" ) )
}
+_urpmi_packages()
+{
+ local options
+
+ # find media selection options
+ for (( i=1; i < COMP_CWORD; i++ )); do
+ case "${COMP_WORDS[i]}" in
+ --@(excludemedia|media))
+ options="$options ${COMP_WORDS[i]} ${COMP_WORDS[i+1]}"
+ i=$(($i+1))
+ ;;
+ --update)
+ options="$options ${COMP_WORDS[i]}"
+ ;;
+ esac
+ done
+
+ COMPREPLY=( $( compgen -W "$(urpmq $options --list)" -- $cur ) )
+}
+
# urpmi completion
#
_urpmi()
@@ -90,8 +110,15 @@ _urpmi()
fi
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
- if [[ ${COMP_WORDS[0]} != *rurpmi ]]; then
- COMPREPLY=( $( compgen -W "$(urpmq --list)" -- $cur ) )
+ if [[ ${COMP_WORDS[0]} == *rurpmi ]]; then
+ # return available packages only
+ _urpmi_packages
+ else
+ # return available packages (unless clearly a file)
+ # and rpm files
+ if [[ "$cur" != */* ]]; then
+ _urpmi_packages
+ fi
_filedir rpm
fi
fi