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