summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-08-01 15:44:40 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-08-01 15:44:40 +0000
commite6d6502758210991a8fff3159b62f386138f6477 (patch)
tree50a33822b47b59db949174e8dd12abe3b58d0122 /urpm
parent348de183f06992ca578503bdba9ce28f15f6ba76 (diff)
downloadurpmi-e6d6502758210991a8fff3159b62f386138f6477.tar
urpmi-e6d6502758210991a8fff3159b62f386138f6477.tar.gz
urpmi-e6d6502758210991a8fff3159b62f386138f6477.tar.bz2
urpmi-e6d6502758210991a8fff3159b62f386138f6477.tar.xz
urpmi-e6d6502758210991a8fff3159b62f386138f6477.zip
factorize handling of -q|--quiet and -v|--verbose for all tools
this fixes -q option not handled by urpmi.update (#31890)
Diffstat (limited to 'urpm')
-rw-r--r--urpm/args.pm16
1 files changed, 6 insertions, 10 deletions
diff --git a/urpm/args.pm b/urpm/args.pm
index be510c83..52576485 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -49,6 +49,8 @@ my %options_spec_all = (
$options{verbose}++;
$urpm->{debug} = $urpm->{debug_URPM} = sub { print STDERR "$_[0]\n" };
},
+ 'q|quiet' => sub { --$options{verbose} },
+ 'v|verbose' => sub { ++$options{verbose} },
'urpmi-root=s' => sub { urpm::set_files($urpm, $_[1]) },
'use-copied-hdlist' => sub { $urpm->{options}{use_copied_hdlist} = 1 },
);
@@ -152,8 +154,6 @@ my %options_spec = (
'no-md5sum' => \$::nomd5sum,
'force-key' => \$::forcekey,
a => \$::all,
- 'q|quiet' => sub { --$options{verbose} },
- 'v|verbose' => sub { ++$options{verbose} },
p => sub { $::use_provides = 1 },
P => sub { $::use_provides = 0 },
y => sub { $urpm->{options}{fuzzy} = 1 },
@@ -162,7 +162,6 @@ my %options_spec = (
urpme => {
auto => \$::auto,
- 'v|verbose' => \$options{verbose},
a => \$::matches,
noscripts => \$::noscripts,
repackage => \$::repackage,
@@ -182,7 +181,6 @@ my %options_spec = (
},
'qf=s' => \$::qf,
'uniq|u' => \$::uniq,
- 'verbose|v' => \$options{verbose},
m => add_param_closure('media'),
i => sub { $::pattern = 'i' },
I => sub { $::pattern = '' },
@@ -254,7 +252,6 @@ my %options_spec = (
'whatrequires-recursive' => sub { $options{what_requires_recursive} = $options{what_requires} = 1 },
y => sub { $urpm->{options}{fuzzy} = 1; $options{all} = 1 },
Y => sub { $urpm->{options}{fuzzy} = 1; $options{all} = $options{caseinsensitive} = 1 },
- 'verbose|v' => \$options{verbose},
i => \$options{info},
l => \$options{list_files},
r => sub {
@@ -291,8 +288,6 @@ my %options_spec = (
'force-key' => \$options{forcekey},
'no-md5sum' => \$options{nomd5sum},
'noa|d' => \my $_dummy, #- default, kept for compatibility
- 'q|quiet' => sub { --$options{verbose} },
- 'v|verbose' => sub { ++$options{verbose} },
'norebuild!' => sub { $urpm->{options}{'build-hdlist-on-error'} = !$_[1]; $options{force} = 0 },
'probe-rpms' => sub { $options{probe_with} = 'rpms' },
'<>' => sub {
@@ -312,8 +307,6 @@ my %options_spec = (
'from=s' => \$options{mirrors_url},
virtual => \$options{virtual},
nopubkey => \$options{nopubkey},
- 'q|quiet' => sub { --$options{verbose} },
- 'v|verbose' => sub { ++$options{verbose} },
raw => \$options{raw},
},
@@ -389,7 +382,7 @@ foreach my $k ("help|h", "wget", "curl", "prozilla", "proxy=s", "proxy-user=s",
$options_spec{'urpmi.addmedia'}{$k} = $options_spec{'urpmi.update'}{$k};
}
-foreach my $k ("a", "c", 'v|verbose', 'q|quiet', '<>') {
+foreach my $k ("a", "c", '<>') {
$options_spec{'urpmi.removemedia'}{$k} = $options_spec{'urpmi.update'}{$k};
}
foreach my $k ("y") {
@@ -416,6 +409,9 @@ sub parse_cmdline {
}
my $ret = GetOptions(%{$options_spec{$tool}}, %options_spec_all);
+ $options{verbose} >= 0 or $urpm->{info} = sub {};
+ $options{verbose} > 0 or $urpm->{log} = sub {};
+
if ($tool ne 'urpmi.addmedia' && $tool ne 'urpmi.update' &&
$options{probe_with} && !$options{usedistrib}) {
die N("Can't use %s without %s", "--probe-$options{probe_with}", "--use-distrib");