Skip to content

Commit

Permalink
fix: make progress bar silent if content-length is not found (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
vigress8 authored May 14, 2024
1 parent 0985b2a commit 72aa2fb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pacup
Original file line number Diff line number Diff line change
Expand Up @@ -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' )
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 72aa2fb

Please sign in to comment.