diff --git a/lib/Doctrine/ORM/Tools/Cli/Printers/AbstractPrinter.php b/lib/Doctrine/ORM/Tools/Cli/Printers/AbstractPrinter.php index 4a9416fe6..9fb07f995 100644 --- a/lib/Doctrine/ORM/Tools/Cli/Printers/AbstractPrinter.php +++ b/lib/Doctrine/ORM/Tools/Cli/Printers/AbstractPrinter.php @@ -144,11 +144,13 @@ abstract class AbstractPrinter * @param string $message Message to be outputted * @param mixed $style Optional style to be applied in message */ - public function write($message, $style = 'ERROR') + public function write($message, $style = 'NONE') { $style = is_string($style) ? $this->getStyle($style) : $style; fwrite($this->_stream, $this->format($message, $style)); + + return $this; } /** @@ -157,9 +159,9 @@ abstract class AbstractPrinter * @param string $message Message to be outputted * @param mixed $style Optional style to be applied in message */ - public function writeln($message, $style = 'ERROR') + public function writeln($message, $style = 'NONE') { - $this->write($message . PHP_EOL, $style); + return $this->write($message . PHP_EOL, $style); } /** diff --git a/lib/Doctrine/ORM/Tools/Cli/Tasks/RunSqlTask.php b/lib/Doctrine/ORM/Tools/Cli/Tasks/RunSqlTask.php index 0d28e3b09..211cd93f5 100644 --- a/lib/Doctrine/ORM/Tools/Cli/Tasks/RunSqlTask.php +++ b/lib/Doctrine/ORM/Tools/Cli/Tasks/RunSqlTask.php @@ -16,7 +16,18 @@ class RunSqlTask extends AbstractTask */ public function extendedHelp() { - $this->getPrinter()->writeln('run-sql extended help.', 'INFO'); + $printer = $this->getPrinter(); + + $printer->write('Task: ')->writeln('run-sql', 'KEYWORD') + ->write('Synopsis: '); + $this->_writeSynopsis($printer); + + $printer->writeln('Description: Executes arbitrary SQL from a file or directly from the command line.') + ->writeln('Options:') + ->write('--sql=', 'KEYWORD') + ->writeln("\tThe SQL to execute.") + ->write('--file=', 'KEYWORD') + ->writeln("\tThe path to the file with the SQL to execute."); } /** @@ -24,10 +35,13 @@ class RunSqlTask extends AbstractTask */ public function basicHelp() { - $this->getPrinter()->write('run-sql', 'KEYWORD'); - $this->getPrinter()->writeln( - ' --file= | --sql=', - 'INFO'); + $this->_writeSynopsis($this->getPrinter()); + } + + private function _writeSynopsis($printer) + { + $printer->write('run-sql', 'KEYWORD') + ->writeln(' --file= | --sql=', 'INFO'); } /** diff --git a/lib/Doctrine/ORM/Tools/Cli/Tasks/SchemaToolTask.php b/lib/Doctrine/ORM/Tools/Cli/Tasks/SchemaToolTask.php index 1b5bb5258..5820e7c9d 100644 --- a/lib/Doctrine/ORM/Tools/Cli/Tasks/SchemaToolTask.php +++ b/lib/Doctrine/ORM/Tools/Cli/Tasks/SchemaToolTask.php @@ -42,7 +42,7 @@ class SchemaToolTask extends AbstractTask */ public function extendedHelp() { - $this->getPrinter()->writeln('create-schema extended help.', 'INFO'); + $this->basicHelp(); } /** @@ -136,7 +136,7 @@ class SchemaToolTask extends AbstractTask if ($isCreate) { if (isset($args['dump-sql'])) { foreach ($tool->getCreateSchemaSql($classes) as $sql) { - $printer->writeln($sql, 'NONE'); + $printer->writeln($sql); } } else { $printer->writeln('Creating database schema...', 'INFO'); @@ -146,7 +146,7 @@ class SchemaToolTask extends AbstractTask } else if ($isDrop) { if (isset($args['dump-sql'])) { foreach ($tool->getDropSchemaSql($classes) as $sql) { - $printer->writeln($sql, 'NONE'); + $printer->writeln($sql); } } else { $printer->writeln('Dropping database schema...', 'INFO');