diff options
-rw-r--r-- | man/C/urpmq.8 | 6 | ||||
-rw-r--r-- | urpm/args.pm | 2 | ||||
-rw-r--r-- | urpmi.bash-completion | 11 | ||||
-rwxr-xr-x | urpmq | 2 |
4 files changed, 12 insertions, 9 deletions
diff --git a/man/C/urpmq.8 b/man/C/urpmq.8 index 7d597ab9..3a9483be 100644 --- a/man/C/urpmq.8 +++ b/man/C/urpmq.8 @@ -47,8 +47,10 @@ generally rejects the upgrade of packages given on command line (or when using --auto-select) when a dependency error occurs. .IP "\fB\--list\fP" List available packages. -.IP "\fB\--list-media\fP" -List available media. +.IP "\fB\--list-media\fP [\fItype\fP]" +List available media. You can optionally add a type: \fBall\fP to list +all media (the default), \fBupdate\fP to list the update media, or +\fBactive\fP to list only active media. .IP "\fB\--list-url\fP" List available media and their URLs. .IP "\fB\--list-nodes\fP" diff --git a/urpm/args.pm b/urpm/args.pm index f953ce88..24993f56 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -189,7 +189,7 @@ my %options_spec = ( keep => \$options{keep}, list => \$options{list}, changelog => \$options{changelog}, - 'list-media' => \$options{list_media}, + 'list-media:s' => sub { $options{list_media} = $_[1] || 'all' }, 'list-url' => \$options{list_url}, 'list-nodes' => \$options{list_nodes}, 'list-aliases' => \$options{list_aliases}, diff --git a/urpmi.bash-completion b/urpmi.bash-completion index 4687ad87..ea1d6895 100644 --- a/urpmi.bash-completion +++ b/urpmi.bash-completion @@ -5,7 +5,7 @@ # utility functions _urpmi_get_medias() { - medias=( $( sed -ne 's/^\(.\+\) \+[^{]\+{$/\1/p' /etc/urpmi/urpmi.cfg 2>/dev/null | sed -e 's/(/\\(/g' -e 's/)/\\)/g' -e 's/ /\\ /g' ) ) + medias=( $( urpmq --list-media $1 2>/dev/null | sed -e 's/(/\\(/g' -e 's/)/\\)/g' -e 's/ /\\ /g' ) ) } _urpmi_medias() @@ -13,7 +13,7 @@ _urpmi_medias() # return list of available media local medias IFS=$'\t\n' # get medias list - _urpmi_get_medias + _urpmi_get_medias all # return matching ones COMPREPLY=( $( compgen -W '${medias[@]}' -- $cur ) ) } @@ -23,8 +23,8 @@ _urpmi_packages() # return list of available packages local medias i j IFS=$'\t\n,' - # get medias list - _urpmi_get_medias + # start with full media list + _urpmi_get_medias active # find media selection options for (( i=1; i < COMP_CWORD; i++ )); do @@ -41,8 +41,7 @@ _urpmi_packages() i=$(($i+1)) fi if [[ "${COMP_WORDS[i]}" == --update ]]; then - COMPREPLY=( $( urpmq --update --list 2>/dev/null | grep "^$cur" ) ) - return 0 + _urpmi_get_medias update fi done @@ -158,6 +158,8 @@ if ($urpm::args::options{list_aliases}) { exit 0; } elsif ($urpm::args::options{list_media} || $urpm::args::options{list_url}) { foreach (@{$urpm->{media}}) { + next if $urpm::args::options{list_media} eq 'update' and ! $_->{update}; + next if $urpm::args::options{list_media} eq 'active' and $_->{ignore}; print $_->{name} . ($urpm::args::options{list_url} ? " $_->{url}" : "") . "\n"; } exit 0; |