Commit 374733a9 authored by romanb's avatar romanb

[2.0] More minor visual cli stuff and help messages

parent 6e8a5110
......@@ -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);
}
/**
......
......@@ -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=<SQL>', 'KEYWORD')
->writeln("\tThe SQL to execute.")
->write('--file=<path>', '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=<path> | --sql=<SQL>',
'INFO');
$this->_writeSynopsis($this->getPrinter());
}
private function _writeSynopsis($printer)
{
$printer->write('run-sql', 'KEYWORD')
->writeln(' --file=<path> | --sql=<SQL>', 'INFO');
}
/**
......
......@@ -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');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment