summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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