Skip to content

Commit 04aa0d8

Browse files
committed
--quiet option support (curl downloader)
1 parent e4a3cf5 commit 04aa0d8

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

TODO.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ TODO
55

66
* support github installation
77
* bundle dependencies into ./local/ and ./onion.lock (json)
8+
* quite option should also disable downlaod progress
89

910
* compile command: which compile source into phar file.
1011
* dist: make php package.

src/Onion/Dependency/DependencyResolver.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ function resolvePearPackage($package)
6868

6969
$channel = new \PEARX\Channel( $host, array(
7070
'cache' => \Onion\Application::getInstance()->getCache(),
71-
'downloader' => \Onion\Downloader\CurlDownloaderFactory::create(),
71+
'downloader' => \Onion\Downloader\CurlDownloaderFactory::create(
72+
$this->logger->level == 0 // quiet
73+
),
7274
));
7375
$depPackage = $channel->findPackage( $packageName );
7476
$this->resolvePearPackage( $depPackage );
@@ -96,7 +98,9 @@ function resolve( $package )
9698

9799
$channel = new \PEARX\Channel( $host , array(
98100
'cache' => \Onion\Application::getInstance()->getCache(),
99-
'downloader' => \Onion\Downloader\CurlDownloaderFactory::create(),
101+
'downloader' => \Onion\Downloader\CurlDownloaderFactory::create(
102+
$this->logger->level == 0 // --quiet option
103+
),
100104
));
101105
$depPackage = $channel->findPackage( $depPackageName );
102106

src/Onion/Downloader/CurlDownloaderFactory.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55

66
class CurlDownloaderFactory
77
{
8-
static function create()
8+
static function create($quiet = false)
99
{
10-
$d = new CurlDownloader;
11-
$d->setProgressHandler( new ProgressBar );
12-
return $d;
10+
if( $quiet ) {
11+
return new CurlDownloader();
12+
}
13+
return new CurlDownloader( array(
14+
'progress' => new ProgressBar
15+
));
1316
}
1417
}

0 commit comments

Comments
 (0)