Reorganise console classes
This commit is contained in:
parent
4fec115627
commit
72ebc50e6c
2
generate
2
generate
@ -66,5 +66,5 @@ software, even if advised of the possibility of such damage.
|
||||
|
||||
require_once("vendor/autoload.php");
|
||||
|
||||
$application = new \Todaymade\Daux\Generator\Application();
|
||||
$application = new \Todaymade\Daux\Console\Application();
|
||||
$application->run();
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php namespace Todaymade\Daux\Generator;
|
||||
<?php namespace Todaymade\Daux\Console;
|
||||
|
||||
use Symfony\Component\Console\Application as SymfonyApplication;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
@ -29,7 +29,7 @@ class Application extends SymfonyApplication
|
||||
// which is used when using the --help option
|
||||
$defaultCommands = parent::getDefaultCommands();
|
||||
|
||||
$defaultCommands[] = new Command();
|
||||
$defaultCommands[] = new Generate();
|
||||
|
||||
return $defaultCommands;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<?php namespace Todaymade\Daux\Generator;
|
||||
<?php namespace Todaymade\Daux\Console;
|
||||
|
||||
use Symfony\Component\Console\Command\Command as SymfonyCommand;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
@ -6,7 +6,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Todaymade\Daux\Daux;
|
||||
|
||||
class Command extends SymfonyCommand
|
||||
class Generate extends SymfonyCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
<?php namespace Todaymade\Daux\Format\Base;
|
||||
<?php namespace Todaymade\Daux\Console;
|
||||
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
@ -7,8 +7,11 @@ trait RunAction
|
||||
protected function runAction($title, OutputInterface $output, $width, \Closure $closure)
|
||||
{
|
||||
$output->write($title);
|
||||
|
||||
$length = function_exists("mb_strlen")? mb_strlen($title) : strlen($title);
|
||||
|
||||
// 8 is the length of the label + 2 let it breathe
|
||||
$padding = $width - strlen($title) - 10;
|
||||
$padding = $width - $length - 10;
|
||||
try {
|
||||
$response = $closure();
|
||||
} catch (\Exception $e) {
|
@ -3,9 +3,9 @@
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Todaymade\Daux\Config;
|
||||
use Todaymade\Daux\Console\RunAction;
|
||||
use Todaymade\Daux\Daux;
|
||||
use Todaymade\Daux\Format\Confluence\CommonMark\CommonMarkConverter;
|
||||
use Todaymade\Daux\Format\Base\RunAction;
|
||||
use Todaymade\Daux\Tree\Content;
|
||||
use Todaymade\Daux\Tree\Directory;
|
||||
|
||||
|
@ -1,12 +1,10 @@
|
||||
<?php namespace Todaymade\Daux\Format\Confluence;
|
||||
|
||||
use GuzzleHttp\Exception\BadResponseException;
|
||||
use GuzzleHttp\Exception\ParseException;
|
||||
use Todaymade\Daux\Format\Base\RunAction;
|
||||
use Todaymade\Daux\Console\RunAction;
|
||||
|
||||
class Publisher
|
||||
{
|
||||
|
||||
use RunAction;
|
||||
|
||||
/**
|
||||
|
@ -3,12 +3,12 @@
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Todaymade\Daux\Config;
|
||||
use Todaymade\Daux\Console\RunAction;
|
||||
use Todaymade\Daux\Daux;
|
||||
use Todaymade\Daux\DauxHelper;
|
||||
use Todaymade\Daux\Format\Base\CommonMark\CommonMarkConverter;
|
||||
use Todaymade\Daux\Format\Base\LiveGenerator;
|
||||
use Todaymade\Daux\Format\Base\RunAction;
|
||||
use Todaymade\Daux\Generator\Helper;
|
||||
use Todaymade\Daux\GeneratorHelper;
|
||||
use Todaymade\Daux\Tree\Content;
|
||||
use Todaymade\Daux\Tree\Directory;
|
||||
use Todaymade\Daux\Tree\Entry;
|
||||
@ -47,7 +47,7 @@ class Generator implements \Todaymade\Daux\Format\Base\Generator, LiveGenerator
|
||||
$output,
|
||||
$width,
|
||||
function() use ($destination) {
|
||||
Helper::copyAssets($destination, $this->daux->local_base);
|
||||
GeneratorHelper::copyAssets($destination, $this->daux->local_base);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php namespace Todaymade\Daux\Generator;
|
||||
<?php namespace Todaymade\Daux;
|
||||
|
||||
class Helper
|
||||
class GeneratorHelper
|
||||
{
|
||||
/**
|
||||
* Copy all files from $path to $local_base
|
Loading…
Reference in New Issue
Block a user