Use symfony console, nicer output

This commit is contained in:
Stéphane Goetz
2015-07-14 22:06:01 +02:00
parent e3c9ce98b8
commit cd65072a20
13 changed files with 359 additions and 426 deletions

View File

@ -1,19 +1,23 @@
<?php namespace Todaymade\Daux\Format\Confluence;
use Symfony\Component\Console\Output\OutputInterface;
use Todaymade\Daux\Config;
use Todaymade\Daux\Daux;
use Todaymade\Daux\Format\Base\RunAction;
use Todaymade\Daux\Tree\Content;
use Todaymade\Daux\Tree\Directory;
use Todaymade\Daux\Tree\Entry;
class Generator
{
use RunAction;
/**
* @var string
*/
protected $prefix;
public function generate(Daux $daux)
public function generate(Daux $daux, OutputInterface $output, $width)
{
$confluence = $daux->getParams()['confluence'];
@ -21,15 +25,24 @@ class Generator
$params = $daux->getParams();
echo "Generating Tree...\n";
$tree = $this->generateRecursive($daux->tree, $params);
$tree['title'] = $this->prefix . $daux->getParams()['title'];
$tree = $this->runAction(
"Generating Tree ...",
$output,
$width,
function() use ($daux, $params) {
$tree = $this->generateRecursive($daux->tree, $params);
$tree['title'] = $this->prefix . $daux->getParams()['title'];
return $tree;
}
);
$output->writeln("Start Publishing...");
echo "Start Publishing...\n";
$publisher = new Publisher($confluence);
$publisher->output = $output;
$publisher->width = $width;
$publisher->publish($tree);
echo "Done !\n";
}
private function generateRecursive(Entry $tree, Config $params, $base_url = '')