[2.0] More minor visual cli stuff and help messages
This commit is contained in:
parent
6e8a511094
commit
374733a9c5
@ -144,11 +144,13 @@ abstract class AbstractPrinter
|
|||||||
* @param string $message Message to be outputted
|
* @param string $message Message to be outputted
|
||||||
* @param mixed $style Optional style to be applied in message
|
* @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;
|
$style = is_string($style) ? $this->getStyle($style) : $style;
|
||||||
|
|
||||||
fwrite($this->_stream, $this->format($message, $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 string $message Message to be outputted
|
||||||
* @param mixed $style Optional style to be applied in message
|
* @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()
|
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()
|
public function basicHelp()
|
||||||
{
|
{
|
||||||
$this->getPrinter()->write('run-sql', 'KEYWORD');
|
$this->_writeSynopsis($this->getPrinter());
|
||||||
$this->getPrinter()->writeln(
|
}
|
||||||
' --file=<path> | --sql=<SQL>',
|
|
||||||
'INFO');
|
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()
|
public function extendedHelp()
|
||||||
{
|
{
|
||||||
$this->getPrinter()->writeln('create-schema extended help.', 'INFO');
|
$this->basicHelp();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -136,7 +136,7 @@ class SchemaToolTask extends AbstractTask
|
|||||||
if ($isCreate) {
|
if ($isCreate) {
|
||||||
if (isset($args['dump-sql'])) {
|
if (isset($args['dump-sql'])) {
|
||||||
foreach ($tool->getCreateSchemaSql($classes) as $sql) {
|
foreach ($tool->getCreateSchemaSql($classes) as $sql) {
|
||||||
$printer->writeln($sql, 'NONE');
|
$printer->writeln($sql);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$printer->writeln('Creating database schema...', 'INFO');
|
$printer->writeln('Creating database schema...', 'INFO');
|
||||||
@ -146,7 +146,7 @@ class SchemaToolTask extends AbstractTask
|
|||||||
} else if ($isDrop) {
|
} else if ($isDrop) {
|
||||||
if (isset($args['dump-sql'])) {
|
if (isset($args['dump-sql'])) {
|
||||||
foreach ($tool->getDropSchemaSql($classes) as $sql) {
|
foreach ($tool->getDropSchemaSql($classes) as $sql) {
|
||||||
$printer->writeln($sql, 'NONE');
|
$printer->writeln($sql);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$printer->writeln('Dropping database schema...', 'INFO');
|
$printer->writeln('Dropping database schema...', 'INFO');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user