diff options
author | Thierry Vignaud <tv@mandriva.org> | 2008-09-09 15:58:30 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2008-09-09 15:58:30 +0000 |
commit | 28e6ec7382bda1d07671c1057c658a1952c60e82 (patch) | |
tree | e8b8af13c28380e1c6d7ed087c7a6e01920b8433 /urpm | |
parent | 2c35f854a76ea94f9e5fdfa4a41f1468a8589dc6 (diff) | |
download | urpmi-28e6ec7382bda1d07671c1057c658a1952c60e82.tar urpmi-28e6ec7382bda1d07671c1057c658a1952c60e82.tar.gz urpmi-28e6ec7382bda1d07671c1057c658a1952c60e82.tar.bz2 urpmi-28e6ec7382bda1d07671c1057c658a1952c60e82.tar.xz urpmi-28e6ec7382bda1d07671c1057c658a1952c60e82.zip |
(set_verbose,set_verbosity) enable rpmdrake to support -q & -v options
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/args.pm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/urpm/args.pm b/urpm/args.pm index 35775da8..95fda9d2 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -49,13 +49,17 @@ sub set_debug { $urpm->{debug} = $urpm->{debug_URPM} = sub { print STDERR "$_[0]\n" }; } +sub set_verbose { + $options{verbose} += $_[0]; +} + # options specifications for Getopt::Long my %options_spec_all = ( 'debug' => sub { set_debug($urpm) }, 'debug-librpm' => sub { URPM::setVerbosity(7) }, # 7 == RPMLOG_DEBUG - 'q|quiet' => sub { --$options{verbose} }, - 'v|verbose' => sub { ++$options{verbose} }, + 'q|quiet' => sub { set_verbose(-1) }, + 'v|verbose' => sub { set_verbose(1) }, 'urpmi-root=s' => sub { urpm::set_files($urpm, $_[1]) }, 'wait-lock' => \$options{wait_lock}, 'use-copied-hdlist' => sub { $urpm->{options}{use_copied_hdlist} = 1 }, @@ -467,6 +471,11 @@ sub set_root { } } +sub set_verbosity { + $options{verbose} >= 0 or $urpm->{info} = sub {}; + $options{verbose} > 0 or $urpm->{log} = sub {}; +} + sub parse_cmdline { my %args = @_; $urpm = $args{urpm}; @@ -475,8 +484,7 @@ 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 {}; + set_verbosity(); $urpm->{tune_rpm} and urpm::tune_rpm($urpm); |