Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
740a7694
Commit
740a7694
authored
Mar 06, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved HelpController with messages for each command
parent
62378c3b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
44 additions
and
9 deletions
+44
-9
BaseController.php
extensions/apidoc/components/BaseController.php
+0
-0
AssetController.php
framework/console/controllers/AssetController.php
+1
-1
CacheController.php
framework/console/controllers/CacheController.php
+1
-1
FixtureController.php
framework/console/controllers/FixtureController.php
+1
-1
HelpController.php
framework/console/controllers/HelpController.php
+38
-4
MessageController.php
framework/console/controllers/MessageController.php
+2
-1
MigrateController.php
framework/console/controllers/MigrateController.php
+1
-1
No files found.
extensions/apidoc/com
mand
s/BaseController.php
→
extensions/apidoc/com
ponent
s/BaseController.php
View file @
740a7694
File moved
framework/console/controllers/AssetController.php
View file @
740a7694
...
...
@@ -12,7 +12,7 @@ use yii\console\Exception;
use
yii\console\Controller
;
/**
*
This command a
llows you to combine and compress your JavaScript and CSS files.
*
A
llows you to combine and compress your JavaScript and CSS files.
*
* Usage:
* 1. Create a configuration file using 'template' action:
...
...
framework/console/controllers/CacheController.php
View file @
740a7694
...
...
@@ -13,7 +13,7 @@ use yii\console\Exception;
use
yii\caching\Cache
;
/**
*
This command a
llows you to flush cache.
*
A
llows you to flush cache.
*
* @author Alexander Makarov <sam@rmcreative.ru>
* @since 2.0
...
...
framework/console/controllers/FixtureController.php
View file @
740a7694
...
...
@@ -15,7 +15,7 @@ use yii\helpers\FileHelper;
use
yii\test\FixtureTrait
;
/**
*
This command m
anages loading and unloading fixtures.
*
M
anages loading and unloading fixtures.
*
* ~~~
* #load fixtures from UsersFixture class with default namespace "tests\unit\fixtures"
...
...
framework/console/controllers/HelpController.php
View file @
740a7694
...
...
@@ -16,7 +16,7 @@ use yii\helpers\Console;
use
yii\helpers\Inflector
;
/**
*
This command p
rovides help information about console commands.
*
P
rovides help information about console commands.
*
* This command displays the available command list in
* the application or the detailed instructions about using
...
...
@@ -82,6 +82,32 @@ class HelpController extends Controller
}
/**
* Returns an array of commands an their descriptions.
* @return array all available commands as keys and their description as values.
*/
protected
function
getCommandDescriptions
()
{
$descriptions
=
[];
foreach
(
$this
->
getCommands
()
as
$command
)
{
$description
=
''
;
$result
=
Yii
::
$app
->
createController
(
$command
);
if
(
$result
!==
false
)
{
list
(
$controller
,
$actionID
)
=
$result
;
$class
=
new
\ReflectionClass
(
$controller
);
$docLines
=
preg_split
(
'~(\n|\r|\r\n)~'
,
$class
->
getDocComment
());
if
(
isset
(
$docLines
[
1
]))
{
$description
=
trim
(
$docLines
[
1
],
' *'
);
}
}
$descriptions
[
$command
]
=
$description
;
}
return
$descriptions
;
}
/**
* Returns all available actions of the specified controller.
* @param Controller $controller the controller instance
* @return array all available action IDs.
...
...
@@ -141,11 +167,19 @@ class HelpController extends Controller
*/
protected
function
getHelp
()
{
$commands
=
$this
->
getCommands
();
$commands
=
$this
->
getCommand
Description
s
();
if
(
!
empty
(
$commands
))
{
$this
->
stdout
(
"
\n
The following commands are available:
\n\n
"
,
Console
::
BOLD
);
foreach
(
$commands
as
$command
)
{
echo
"- "
.
$this
->
ansiFormat
(
$command
,
Console
::
FG_YELLOW
)
.
"
\n
"
;
$len
=
0
;
foreach
(
$commands
as
$command
=>
$description
)
{
if
((
$l
=
strlen
(
$command
))
>
$len
)
{
$len
=
$l
;
}
}
foreach
(
$commands
as
$command
=>
$description
)
{
echo
"- "
.
$this
->
ansiFormat
(
$command
,
Console
::
FG_YELLOW
);
echo
str_repeat
(
' '
,
$len
+
3
-
strlen
(
$command
))
.
$description
;
echo
"
\n
"
;
}
$scriptName
=
$this
->
getScriptName
();
$this
->
stdout
(
"
\n
To see the help of each command, enter:
\n
"
,
Console
::
BOLD
);
...
...
framework/console/controllers/MessageController.php
View file @
740a7694
...
...
@@ -14,7 +14,8 @@ use yii\console\Exception;
use
yii\helpers\FileHelper
;
/**
* This command extracts messages to be translated from source files.
* Extracts messages to be translated from source files.
*
* The extracted messages can be saved the following depending on `format`
* setting in config file:
*
...
...
framework/console/controllers/MigrateController.php
View file @
740a7694
...
...
@@ -17,7 +17,7 @@ use yii\helpers\ArrayHelper;
use
yii\helpers\FileHelper
;
/**
*
This command m
anages application migrations.
*
M
anages application migrations.
*
* A migration means a set of persistent changes to the application environment
* that is shared among different developers. For example, in an application
...
...
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