Commit 203b46de authored by guilhermeblanco's avatar guilhermeblanco

[2.0] Changed stylish of CLI tasks. Added CLI documentation for SchemaTool task

parent 1557f4e1
...@@ -42,12 +42,14 @@ class AnsiColorPrinter extends AbstractPrinter ...@@ -42,12 +42,14 @@ class AnsiColorPrinter extends AbstractPrinter
protected function _initStyles() protected function _initStyles()
{ {
$this->addStyles(array( $this->addStyles(array(
'HEADER' => new Style('DEFAULT', 'DEFAULT', array('BOLD' => true)),
'ERROR' => new Style('WHITE', 'RED', array('BOLD' => true)), 'ERROR' => new Style('WHITE', 'RED', array('BOLD' => true)),
'WARNING' => new Style('DEFAULT', 'YELLOW'), 'WARNING' => new Style('DEFAULT', 'YELLOW'),
'KEYWORD' => new Style('BLUE', 'DEFAULT', array('BOLD' => true)), 'KEYWORD' => new Style('BLUE', 'DEFAULT', array('BOLD' => true)),
'REQ_ARG' => new Style('MAGENTA', 'DEFAULT', array('BOLD' => true)),
'OPT_ARG' => new Style('CYAN', 'DEFAULT', array('BOLD' => true)),
'INFO' => new Style('GREEN', 'DEFAULT', array('BOLD' => true)), 'INFO' => new Style('GREEN', 'DEFAULT', array('BOLD' => true)),
'COMMENT' => new Style('DEFAULT', 'MAGENTA'), 'COMMENT' => new Style('DEFAULT', 'MAGENTA'),
'HEADER' => new Style('DEFAULT', 'DEFAULT', array('BOLD' => true)),
'NONE' => new Style(), 'NONE' => new Style(),
)); ));
} }
......
...@@ -24,10 +24,13 @@ class RunSqlTask extends AbstractTask ...@@ -24,10 +24,13 @@ class RunSqlTask extends AbstractTask
$printer->writeln('Description: Executes arbitrary SQL from a file or directly from the command line.') $printer->writeln('Description: Executes arbitrary SQL from a file or directly from the command line.')
->writeln('Options:') ->writeln('Options:')
->write('--sql=<SQL>', 'KEYWORD') ->write('--sql=<SQL>', 'REQ_ARG')
->writeln("\tThe SQL to execute.") ->writeln("\tThe SQL to execute.")
->write('--file=<path>', 'KEYWORD') ->writeln("\t\tIf defined, --file can not be requested on same task")
->writeln("\tThe path to the file with the SQL to execute."); ->write(PHP_EOL)
->write('--file=<path>', 'REQ_ARG')
->writeln("\tThe path to the file with the SQL to execute.")
->writeln("\t\tIf defined, --sql can not be requested on same task");
} }
/** /**
...@@ -41,7 +44,7 @@ class RunSqlTask extends AbstractTask ...@@ -41,7 +44,7 @@ class RunSqlTask extends AbstractTask
private function _writeSynopsis($printer) private function _writeSynopsis($printer)
{ {
$printer->write('run-sql', 'KEYWORD') $printer->write('run-sql', 'KEYWORD')
->writeln(' (--file=<path> | --sql=<SQL>)', 'INFO'); ->writeln(' (--file=<path> | --sql=<SQL>)', 'REQ_ARG');
} }
/** /**
......
...@@ -42,7 +42,31 @@ class SchemaToolTask extends AbstractTask ...@@ -42,7 +42,31 @@ class SchemaToolTask extends AbstractTask
*/ */
public function extendedHelp() public function extendedHelp()
{ {
$this->basicHelp(); $printer = $this->getPrinter();
$printer->write('Task: ')->writeln('schema-tool', 'KEYWORD')
->write('Synopsis: ');
$this->_writeSynopsis($printer);
$printer->writeln('Description: Processes the schema and either apply it directly on EntityManager or generate the SQL output.')
->writeln('Options:')
->write('--create', 'REQ_ARG')
->writeln("\t\tCreates the schema in EntityManager (create tables on Database)")
->writeln("\t\t\tIf defined, --drop and --update can not be requested on same task")
->write(PHP_EOL)
->write('--drop', 'REQ_ARG')
->writeln("\t\t\tDrops the schema of EntityManager (drop tables on Database)")
->writeln("\t\t\tIf defined, --create and --update can not be requested on same task")
->write(PHP_EOL)
->write('--update', 'REQ_ARG')
->writeln("\t\tUpdates the schema in EntityManager (update tables on Database)")
->writeln("\t\t\tIf defined, --create and --drop can not be requested on same task")
->write(PHP_EOL)
->write('--dump-sql', 'OPT_ARG')
->writeln("\t\tInstead of try to apply generated SQLs into EntityManager, output them.")
->write(PHP_EOL)
->write('--classdir=<path>', 'OPT_ARG')
->writeln("\tOptional class directory to fetch for Entities.");
} }
/** /**
...@@ -50,10 +74,14 @@ class SchemaToolTask extends AbstractTask ...@@ -50,10 +74,14 @@ class SchemaToolTask extends AbstractTask
*/ */
public function basicHelp() public function basicHelp()
{ {
$this->getPrinter()->write('schema-tool', 'KEYWORD'); $this->_writeSynopsis($this->getPrinter());
$this->getPrinter()->writeln( }
' (--create | --drop | --update) [--dump-sql] [--classdir=<path>]',
'INFO'); private function _writeSynopsis($printer)
{
$printer->write('schema-tool', 'KEYWORD')
->write(' (--create | --drop | --update)', 'REQ_ARG')
->writeln(' [--dump-sql] [--classdir=<path>]', 'OPT_ARG');
} }
/** /**
......
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