X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fpharext%2FPackager.php;h=cd1d43681d2d9a1167615c170365175cc3c5c9b4;hb=66d7a880cb37f809df6806e5dc62d191dc257d08;hp=53fbca23bc498d67661a797f95cc3232d1ac84b3;hpb=3d815714b67ce0ab66c9e075edf8d0afb82d33ad;p=pharext%2Fpharext diff --git a/src/pharext/Packager.php b/src/pharext/Packager.php index 53fbca2..cd1d436 100644 --- a/src/pharext/Packager.php +++ b/src/pharext/Packager.php @@ -144,13 +144,20 @@ class Packager implements Command if ($this->args->git) { $task = new Task\GitClone($source); } else { - $task = new Task\StreamFetch($source, function($bytes_pct) { - $this->info(" %3d%% [%s>%s] \r%s", - floor($bytes_pct*100), - str_repeat("=", round(50*$bytes_pct)), - str_repeat(" ", round(50*(1-$bytes_pct))), - $bytes_pct == 1 ? "\n":"" - ); + /* print newline only once */ + $done = false; + $task = new Task\StreamFetch($source, function($bytes_pct) use(&$done) { + if (!$done) { + $this->info(" %3d%% [%s>%s] \r", + floor($bytes_pct*100), + str_repeat("=", round(50*$bytes_pct)), + str_repeat(" ", round(50*(1-$bytes_pct))) + ); + if ($bytes_pct == 1) { + $done = true; + printf("\n"); + } + } }); } $local = $task->run($this->verbosity()); @@ -213,7 +220,7 @@ class Packager implements Command $this->source = new SourceDir\Pecl($source); } elseif ($this->args["git"]) { $this->source = new SourceDir\Git($source); - } elseif (is_file("$source/parext_package.php")) { + } elseif (is_file("$source/pharext_package.php")) { $this->source = include "$source/pharext_package.php"; } else { $this->source = new SourceDir\Basic($source);