summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-01-27 11:10:04 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-01-27 11:10:04 +0000
commita2e352a80301a243c139f50b75a5bdfcafd86ad9 (patch)
treef39ba5c4303d4ce6d1579e65561d0e73cb7ff1d3
parentde30d10b40a5db24883762c45897bd9d8d3fb9b9 (diff)
downloadurpmi-a2e352a80301a243c139f50b75a5bdfcafd86ad9.tar
urpmi-a2e352a80301a243c139f50b75a5bdfcafd86ad9.tar.gz
urpmi-a2e352a80301a243c139f50b75a5bdfcafd86ad9.tar.bz2
urpmi-a2e352a80301a243c139f50b75a5bdfcafd86ad9.tar.xz
urpmi-a2e352a80301a243c139f50b75a5bdfcafd86ad9.zip
Patch by Guillaume Rousse to improve bash-completion for media names, via
adding new optional arguments to the --list-media option of urpmq.
-rw-r--r--man/C/urpmq.86
-rw-r--r--urpm/args.pm2
-rw-r--r--urpmi.bash-completion11
-rwxr-xr-xurpmq2
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
diff --git a/urpmq b/urpmq
index 00c66c75..5d9eb540 100755
--- a/urpmq
+++ b/urpmq
@@ -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;