[2.0] Changed stylish of CLI tasks. Added CLI documentation for SchemaTool task
This commit is contained in:
parent
1557f4e103
commit
203b46dea2
@ -42,12 +42,14 @@ class AnsiColorPrinter extends AbstractPrinter
|
||||
protected function _initStyles()
|
||||
{
|
||||
$this->addStyles(array(
|
||||
'HEADER' => new Style('DEFAULT', 'DEFAULT', array('BOLD' => true)),
|
||||
'ERROR' => new Style('WHITE', 'RED', array('BOLD' => true)),
|
||||
'WARNING' => new Style('DEFAULT', 'YELLOW'),
|
||||
'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)),
|
||||
'COMMENT' => new Style('DEFAULT', 'MAGENTA'),
|
||||
'HEADER' => new Style('DEFAULT', 'DEFAULT', array('BOLD' => true)),
|
||||
'NONE' => new Style(),
|
||||
));
|
||||
}
|
||||
|
@ -24,10 +24,13 @@ class RunSqlTask extends AbstractTask
|
||||
|
||||
$printer->writeln('Description: Executes arbitrary SQL from a file or directly from the command line.')
|
||||
->writeln('Options:')
|
||||
->write('--sql=<SQL>', 'KEYWORD')
|
||||
->write('--sql=<SQL>', 'REQ_ARG')
|
||||
->writeln("\tThe SQL to execute.")
|
||||
->write('--file=<path>', 'KEYWORD')
|
||||
->writeln("\tThe path to the file with the SQL to execute.");
|
||||
->writeln("\t\tIf defined, --file can not be requested on same task")
|
||||
->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
|
||||
private function _writeSynopsis($printer)
|
||||
{
|
||||
$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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public function basicHelp()
|
||||
{
|
||||
$this->getPrinter()->write('schema-tool', 'KEYWORD');
|
||||
$this->getPrinter()->writeln(
|
||||
' (--create | --drop | --update) [--dump-sql] [--classdir=<path>]',
|
||||
'INFO');
|
||||
$this->_writeSynopsis($this->getPrinter());
|
||||
}
|
||||
|
||||
private function _writeSynopsis($printer)
|
||||
{
|
||||
$printer->write('schema-tool', 'KEYWORD')
|
||||
->write(' (--create | --drop | --update)', 'REQ_ARG')
|
||||
->writeln(' [--dump-sql] [--classdir=<path>]', 'OPT_ARG');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user