diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-10-07 17:03:40 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-10-07 17:03:40 +0000 |
commit | 74115097fd19a940f41785f28f40c7620d957804 (patch) | |
tree | e127e20d95720b69952ded4544b40ff987304d0d /urpm | |
parent | ce08405069bef2e018a1cdfd9b8706725678af67 (diff) | |
download | urpmi-74115097fd19a940f41785f28f40c7620d957804.tar urpmi-74115097fd19a940f41785f28f40c7620d957804.tar.gz urpmi-74115097fd19a940f41785f28f40c7620d957804.tar.bz2 urpmi-74115097fd19a940f41785f28f40c7620d957804.tar.xz urpmi-74115097fd19a940f41785f28f40c7620d957804.zip |
- gurpmi:
o overall progress-bar, display the download speed, nicer looking
- urpm::download::progress_text() is created out of urpm::download::sync_logger
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/download.pm | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/urpm/download.pm b/urpm/download.pm index db844d41..e8c5a950 100644 --- a/urpm/download.pm +++ b/urpm/download.pm @@ -750,18 +750,21 @@ eval { --$wchar; }; +sub progress_text { + my ($mode, $file, $percent, $total, $eta, $speed) = @_; + $mode eq 'progress' ? + (defined $total && defined $eta ? + N(" %s%% of %s completed, ETA = %s, speed = %s", $percent, $total, $eta, $speed) : + N(" %s%% completed, speed = %s", $percent, $speed)) : ''; +} + #- default logger suitable for sync operation on STDERR only. sub sync_logger { my ($mode, $file, $percent, $total, $eta, $speed) = @_; if ($mode eq 'start') { print STDERR " $file\n"; } elsif ($mode eq 'progress') { - my $text; - if (defined $total && defined $eta) { - $text = N(" %s%% of %s completed, ETA = %s, speed = %s", $percent, $total, $eta, $speed); - } else { - $text = N(" %s%% completed, speed = %s", $percent, $speed); - } + my $text = &progress_text; if (length($text) > $wchar) { $text = substr($text, 0, $wchar) } if (bytes::length($text) < $wchar) { # clearing more than needed in case the terminal is not handling utf8 and we have a utf8 string |