From 6fa815d1743aeaa9b14d8ca118f8539a26c4a347 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Thu, 11 Jul 2013 12:54:38 +0200 Subject: [PATCH] add possibility to render a block on command output --- Thelia | 3 +- .../Thelia/Command/ModuleGenerateCommand.php | 7 ++++ .../Command/Output/TheliaConsoleOutput.php | 36 +++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 core/lib/Thelia/Command/Output/TheliaConsoleOutput.php diff --git a/Thelia b/Thelia index 2aaa3c3e5..a161b610f 100755 --- a/Thelia +++ b/Thelia @@ -7,6 +7,7 @@ require __DIR__ . '/core/bootstrap.php'; use Thelia\Core\Thelia; use Thelia\Core\Application; +use Thelia\Command\Output\TheliaConsoleOutput; use Symfony\Component\Console\Input\ArgvInput; $input = new ArgvInput(); @@ -15,4 +16,4 @@ $debug = getenv('THELIA_DEBUG') !== '0' && !$input->hasParameterOption(array('-- $thelia = new Thelia($env, $debug); $application = new Application($thelia); -$application->run($input); \ No newline at end of file +$application->run($input, new TheliaConsoleOutput()); \ No newline at end of file diff --git a/core/lib/Thelia/Command/ModuleGenerateCommand.php b/core/lib/Thelia/Command/ModuleGenerateCommand.php index 4a31a74ab..5edcd4d97 100644 --- a/core/lib/Thelia/Command/ModuleGenerateCommand.php +++ b/core/lib/Thelia/Command/ModuleGenerateCommand.php @@ -64,6 +64,13 @@ class ModuleGenerateCommand extends ContainerAwareCommand { $this->createDirectories(); $this->createFiles(); + + $output->renderBlock(array( + '', + sprintf("module %s create with success", $this->module), + "You can now configure your module and complete plugin.xml file", + '' + ), "bg=green;fg=black"); } private function createDirectories() diff --git a/core/lib/Thelia/Command/Output/TheliaConsoleOutput.php b/core/lib/Thelia/Command/Output/TheliaConsoleOutput.php new file mode 100644 index 000000000..ad40c6dbd --- /dev/null +++ b/core/lib/Thelia/Command/Output/TheliaConsoleOutput.php @@ -0,0 +1,36 @@ + $length) ? $strlen($message) : $length; + } + $ouput = array(); + foreach ($messages as $message) { + $output[] = "<" . $style . ">" . " " . $message . str_repeat(' ', $length - $strlen($message)) . " "; + } + + $this->writeln($output); + } + +} \ No newline at end of file