Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
7411ca35
Commit
7411ca35
authored
Sep 01, 2009
by
guilhermeblanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] More work on CLI Tasks. Implemented HelpTask.
parent
2442cfa8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
22 deletions
+35
-22
Cli.php
lib/Doctrine/ORM/Tools/Cli.php
+5
-1
HelpTask.php
lib/Doctrine/ORM/Tools/Cli/Tasks/HelpTask.php
+21
-15
VersionTask.php
lib/Doctrine/ORM/Tools/Cli/Tasks/VersionTask.php
+9
-6
No files found.
lib/Doctrine/ORM/Tools/Cli.php
View file @
7411ca35
...
@@ -156,6 +156,10 @@ class Cli
...
@@ -156,6 +156,10 @@ class Cli
$processedArgs
=
$this
->
_processArguments
(
$args
);
$processedArgs
=
$this
->
_processArguments
(
$args
);
try
{
try
{
$this
->
_printer
->
writeln
(
'Doctrine Command Line Interface'
.
PHP_EOL
,
'HEADER'
);
// Handle possible multiple tasks on a single command
// Handle possible multiple tasks on a single command
foreach
(
$processedArgs
as
$taskData
)
{
foreach
(
$processedArgs
as
$taskData
)
{
// Retrieve the task name and arguments
// Retrieve the task name and arguments
...
@@ -182,7 +186,7 @@ class Cli
...
@@ -182,7 +186,7 @@ class Cli
}
}
}
}
}
catch
(
\Doctrine\Common\DoctrineException
$e
)
{
}
catch
(
\Doctrine\Common\DoctrineException
$e
)
{
$this
->
_printer
->
write
(
$this
->
_printer
->
write
ln
(
$taskName
.
':'
.
$e
->
getMessage
()
.
PHP_EOL
,
'ERROR'
$taskName
.
':'
.
$e
->
getMessage
()
.
PHP_EOL
,
'ERROR'
);
);
}
}
...
...
lib/Doctrine/ORM/Tools/Cli/Tasks/HelpTask.php
View file @
7411ca35
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
namespace
Doctrine\ORM\Tools\Cli\Tasks
;
namespace
Doctrine\ORM\Tools\Cli\Tasks
;
use
Doctrine\Common\Util\Inflector
;
/**
/**
* CLI Task to display available commands help
* CLI Task to display available commands help
*
*
...
@@ -39,11 +41,7 @@ class HelpTask extends AbstractTask
...
@@ -39,11 +41,7 @@ class HelpTask extends AbstractTask
*/
*/
public
function
extendedHelp
()
public
function
extendedHelp
()
{
{
$this
->
getPrinter
()
->
write
(
'help extended help'
.
PHP_EOL
,
'HEADER'
);
$this
->
run
();
$this
->
getPrinter
()
->
write
(
'help extended help'
.
PHP_EOL
,
'ERROR'
);
$this
->
getPrinter
()
->
write
(
'help extended help'
.
PHP_EOL
,
'INFO'
);
$this
->
getPrinter
()
->
write
(
'help extended help'
.
PHP_EOL
,
'COMMENT'
);
$this
->
getPrinter
()
->
write
(
'help extended help'
.
PHP_EOL
,
'NONE'
);
}
}
/**
/**
...
@@ -51,11 +49,7 @@ class HelpTask extends AbstractTask
...
@@ -51,11 +49,7 @@ class HelpTask extends AbstractTask
*/
*/
public
function
basicHelp
()
public
function
basicHelp
()
{
{
$this
->
getPrinter
()
->
write
(
'help basic help'
.
PHP_EOL
,
'HEADER'
);
$this
->
run
();
$this
->
getPrinter
()
->
write
(
'help basic help'
.
PHP_EOL
,
'ERROR'
);
$this
->
getPrinter
()
->
write
(
'help basic help'
.
PHP_EOL
,
'INFO'
);
$this
->
getPrinter
()
->
write
(
'help basic help'
.
PHP_EOL
,
'COMMENT'
);
$this
->
getPrinter
()
->
write
(
'help basic help'
.
PHP_EOL
,
'NONE'
);
}
}
/**
/**
...
@@ -72,10 +66,22 @@ class HelpTask extends AbstractTask
...
@@ -72,10 +66,22 @@ class HelpTask extends AbstractTask
*/
*/
public
function
run
()
public
function
run
()
{
{
$this
->
getPrinter
()
->
write
(
'help run'
.
PHP_EOL
,
'HEADER'
);
// Switch between ALL available tasks and display the basic Help of each one
$this
->
getPrinter
()
->
write
(
'help run'
.
PHP_EOL
,
'ERROR'
);
$availableTasks
=
$this
->
getAvailableTasks
();
$this
->
getPrinter
()
->
write
(
'help run'
.
PHP_EOL
,
'INFO'
);
$this
->
getPrinter
()
->
write
(
'help run'
.
PHP_EOL
,
'COMMENT'
);
$helpTaskName
=
Inflector
::
classify
(
str_replace
(
'-'
,
'_'
,
'help'
));
$this
->
getPrinter
()
->
write
(
'help run'
.
PHP_EOL
,
'NONE'
);
unset
(
$availableTasks
[
$helpTaskName
]);
ksort
(
$availableTasks
);
foreach
(
$availableTasks
as
$taskName
=>
$taskClass
)
{
$task
=
new
$taskClass
();
$task
->
setAvailableTasks
(
$availableTasks
);
$task
->
setPrinter
(
$this
->
getPrinter
());
$task
->
setArguments
(
$this
->
getArguments
());
$task
->
basicHelp
();
}
}
}
}
}
\ No newline at end of file
lib/Doctrine/ORM/Tools/Cli/Tasks/VersionTask.php
View file @
7411ca35
...
@@ -39,11 +39,12 @@ class VersionTask extends AbstractTask
...
@@ -39,11 +39,12 @@ class VersionTask extends AbstractTask
*/
*/
public
function
extendedHelp
()
public
function
extendedHelp
()
{
{
$this
->
getPrinter
()
->
write
(
'version extended help'
.
PHP_EOL
,
'HEADER'
);
$this
->
getPrinter
()
->
writeln
(
'version extended help.'
,
'INFO'
);
/*$this->getPrinter()->write('version extended help' . PHP_EOL, 'HEADER');
$this->getPrinter()->write('version extended help' . PHP_EOL, 'ERROR');
$this->getPrinter()->write('version extended help' . PHP_EOL, 'ERROR');
$this->getPrinter()->write('version extended help' . PHP_EOL, 'INFO');
$this->getPrinter()->write('version extended help' . PHP_EOL, 'INFO');
$this->getPrinter()->write('version extended help' . PHP_EOL, 'COMMENT');
$this->getPrinter()->write('version extended help' . PHP_EOL, 'COMMENT');
$this
->
getPrinter
()
->
write
(
'version extended help'
.
PHP_EOL
,
'NONE'
);
$this->getPrinter()->write('version extended help' . PHP_EOL, 'NONE');
*/
}
}
/**
/**
...
@@ -51,11 +52,12 @@ class VersionTask extends AbstractTask
...
@@ -51,11 +52,12 @@ class VersionTask extends AbstractTask
*/
*/
public
function
basicHelp
()
public
function
basicHelp
()
{
{
$this
->
getPrinter
()
->
write
(
'version basic help'
.
PHP_EOL
,
'HEADER'
);
$this
->
getPrinter
()
->
writeln
(
'version extended help.'
,
'INFO'
);
/*$this->getPrinter()->write('version basic help' . PHP_EOL, 'HEADER');
$this->getPrinter()->write('version basic help' . PHP_EOL, 'ERROR');
$this->getPrinter()->write('version basic help' . PHP_EOL, 'ERROR');
$this->getPrinter()->write('version basic help' . PHP_EOL, 'INFO');
$this->getPrinter()->write('version basic help' . PHP_EOL, 'INFO');
$this->getPrinter()->write('version basic help' . PHP_EOL, 'COMMENT');
$this->getPrinter()->write('version basic help' . PHP_EOL, 'COMMENT');
$this
->
getPrinter
()
->
write
(
'version basic help'
.
PHP_EOL
,
'NONE'
);
$this->getPrinter()->write('version basic help' . PHP_EOL, 'NONE');
*/
}
}
/**
/**
...
@@ -72,10 +74,11 @@ class VersionTask extends AbstractTask
...
@@ -72,10 +74,11 @@ class VersionTask extends AbstractTask
*/
*/
public
function
run
()
public
function
run
()
{
{
$this
->
getPrinter
()
->
write
(
'version run'
.
PHP_EOL
,
'HEADER'
);
$this
->
getPrinter
()
->
writeln
(
'version normal flow.'
,
'INFO'
);
/*$this->getPrinter()->write('version run' . PHP_EOL, 'HEADER');
$this->getPrinter()->write('version run' . PHP_EOL, 'ERROR');
$this->getPrinter()->write('version run' . PHP_EOL, 'ERROR');
$this->getPrinter()->write('version run' . PHP_EOL, 'INFO');
$this->getPrinter()->write('version run' . PHP_EOL, 'INFO');
$this->getPrinter()->write('version run' . PHP_EOL, 'COMMENT');
$this->getPrinter()->write('version run' . PHP_EOL, 'COMMENT');
$this
->
getPrinter
()
->
write
(
'version run'
.
PHP_EOL
,
'NONE'
);
$this->getPrinter()->write('version run' . PHP_EOL, 'NONE');
*/
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment