diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-10-07 17:30:57 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-10-07 17:30:57 +0000 |
commit | 9186cdebecaeb80a5cb9cc41cbfa46092a04c06f (patch) | |
tree | d942169308398cf087f838453148a91ad8129404 /urpm/download.pm | |
parent | e04ff185c0ae968f633194057654e9c18c974cd6 (diff) | |
download | urpmi-9186cdebecaeb80a5cb9cc41cbfa46092a04c06f.tar urpmi-9186cdebecaeb80a5cb9cc41cbfa46092a04c06f.tar.gz urpmi-9186cdebecaeb80a5cb9cc41cbfa46092a04c06f.tar.bz2 urpmi-9186cdebecaeb80a5cb9cc41cbfa46092a04c06f.tar.xz urpmi-9186cdebecaeb80a5cb9cc41cbfa46092a04c06f.zip |
- gurpmi
o overall progress-bar, display the download speed, nicer looking
Diffstat (limited to 'urpm/download.pm')
-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 |