From d4c190c77069e95998f874450540ca0cbc44f1b1 Mon Sep 17 00:00:00 2001 From: cornernote Date: Tue, 11 Aug 2015 18:15:52 +0930 Subject: [PATCH] add stats to import --- src/commands/PackageController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/PackageController.php b/src/commands/PackageController.php index 5fec1fa..e2189ce 100644 --- a/src/commands/PackageController.php +++ b/src/commands/PackageController.php @@ -51,9 +51,11 @@ class PackageController extends Controller '/archive-tarball/master.git' => '.git', 'https://repo.or.cz/' => 'http://repo.or.cz/', ]; - $csv = array_map('str_getcsv', explode("\n", file_get_contents($file))); + $csv = array_map('str_getcsv', explode("\n", trim(file_get_contents($file)))); array_shift($csv); - foreach ($csv as $row) { + $count = count($csv); + foreach ($csv as $k => $row) { + $this->stdout('[' . ($k + 1) . '/' . $count . '] ', Console::FG_GREY); if (!isset($row['1'])) { continue; }