From 72aa2fb1e173b17fb4fea0e7b2d9ff2026d4acdc Mon Sep 17 00:00:00 2001 From: V <150687949+vigress8@users.noreply.github.com> Date: Tue, 14 May 2024 09:03:09 +0400 Subject: [PATCH] fix: make progress bar silent if content-length is not found (#14) --- pacup | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pacup b/pacup index ef60b15..bce993c 100755 --- a/pacup +++ b/pacup @@ -218,7 +218,9 @@ sub repology_get_newestver ( $response, $filters, $oldver, $action ) { print $json_text; } push @filtered, $entry; - if ( $entry->{'status'} ne 'newest' && $version_count{ $entry->{'version'} }) { + if ( $entry->{'status'} ne 'newest' + && $version_count{ $entry->{'version'} } ) + { next unless ( $filters->{'status'} && $filters->{'status'} eq 'devel' ) @@ -262,9 +264,10 @@ sub fetch_source_entry ( $ua, $url, $outfile ) { my $final_url = $response->request->uri; my $file_size = $ua->head($final_url)->header('Content-Length'); my $progress = Term::ProgressBar->new( - { count => $file_size, + { count => $file_size // 0, ETA => 'linear', - remove => 0 + remove => 0, + silent => !defined $file_size, } ); $progress->minor(0);