summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-07-27 02:25:26 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-07-27 02:25:26 +0000
commit458bbe750abd279dc9749b824a986a73f0cffafd (patch)
tree33b0993575752b9985b8a4fb6be66d421d9c51eb
parent01f500e8ee880ad2c249d0fcdad00b70d721c257 (diff)
downloadurpmi-458bbe750abd279dc9749b824a986a73f0cffafd.tar
urpmi-458bbe750abd279dc9749b824a986a73f0cffafd.tar.gz
urpmi-458bbe750abd279dc9749b824a986a73f0cffafd.tar.bz2
urpmi-458bbe750abd279dc9749b824a986a73f0cffafd.tar.xz
urpmi-458bbe750abd279dc9749b824a986a73f0cffafd.zip
Add options -q and -v (quiet and verbose) to urpmi.{add,remove}media
-rw-r--r--urpm/args.pm2
-rwxr-xr-xurpmi.addmedia6
-rwxr-xr-xurpmi.removemedia8
3 files changed, 16 insertions, 0 deletions
diff --git a/urpm/args.pm b/urpm/args.pm
index 76a60460..48ce9b38 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -256,6 +256,8 @@ my %options_spec = (
'version=s' => \$options{version},
'arch=s' => \$options{arch},
virtual => \$options{virtual},
+ 'q|quiet' => sub { --$options{verbose} },
+ 'v|verbose' => sub { ++$options{verbose} },
'<>' => sub {
if ($_[0] =~ /^--distrib-(.*)$/) {
$options{distrib} = $1;
diff --git a/urpmi.addmedia b/urpmi.addmedia
index 3f66fa4c..ca73dc57 100755
--- a/urpmi.addmedia
+++ b/urpmi.addmedia
@@ -74,6 +74,8 @@ and [options] are from
") . N(" --no-md5sum - disable MD5SUM file checking.
") . N(" -c - clean headers cache directory.
") . N(" -f - force generation of hdlist files.
+") . N(" -q - quiet mode.
+") . N(" -v - verbose mode.
");
warn $m ? "$usage\n$m" : $usage;
exit 0;
@@ -96,11 +98,15 @@ sub main {
}
$options{force} = 0;
$options{noclean} = 1;
+ $options{verbose} = 1;
$options{probe_with} = 'synthesis'; #- no the default is to probe synthesis file.
my $urpm = new urpm;
urpm::args::parse_cmdline(urpm => $urpm);
our ($name, $url, $with, $relative_hdlist) = our @cmdline;
+ #- remove verbose if not asked.
+ $options{verbose} > 0 or $urpm->{log} = sub {};
+
#- allow not to give name immediately.
$options{distrib} or $url or ($url, $name) = ($name, '');
my ($type) = $url =~ m,^([^:]*)://, or $options{distrib} or usage;
diff --git a/urpmi.removemedia b/urpmi.removemedia
index 9ac8f913..4a2d9e25 100755
--- a/urpmi.removemedia
+++ b/urpmi.removemedia
@@ -29,16 +29,21 @@ sub main {
$options{noclean} = 1;
$options{strict_match} = 1;
+ $options{verbose} = 1;
foreach (@_) {
/^--?a$/ and $options{all} = 1, next;
/^--?c$/ and $options{noclean} = 0, next;
/^--?y$/ and $options{strict_match} = 0, next;
+ /^--?v$/ and $options{verbose} = 1, next;
+ /^--?q$/ and $options{verbose} = 0, next;
/^-/ and die N("usage: urpmi.removemedia [-a] <name> ...
where <name> is a medium name to remove.
") . N(" --help - print this help message.
") . N(" -a - select all media.
") . N(" -c - clean headers cache directory.
") . N(" -y - fuzzy match on media names.
+") . N(" -q - quiet mode.
+") . N(" -v - verbose mode.
") . (/^--?h(?:elp)$/ ? '' : N("\nunknown options '%s'\n", $_));
push @toremoves, $_;
}
@@ -47,6 +52,9 @@ where <name> is a medium name to remove.
if ($< != 0) {
$urpm->{fatal}(1, N("Only superuser is allowed to remove media"));
}
+
+ $options{verbose} > 0 or $urpm->{log} = sub {};
+
$urpm->read_config;
my @entries = map { $_->{name} } @{$urpm->{media}};