mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-04 22:57:40 +08:00
Fixes #12028: Add -h|--help option to console command to display help information
This commit is contained in:
committed by
Alexander Makarov
parent
f6ff90f672
commit
cffb3832d1
@ -21,7 +21,7 @@ Yii Framework 2 Change Log
|
|||||||
- Enh #12038: Introduced `yii\base\ViewNotFoundException` which is thrown when views file doesn't exists, used it in `ViewAction` (samdark)
|
- Enh #12038: Introduced `yii\base\ViewNotFoundException` which is thrown when views file doesn't exists, used it in `ViewAction` (samdark)
|
||||||
- Enh #11979: Added `yii\mutex\OracleMutex` which implements mutex "lock" mechanism via Oracle locks (zlakomanoff)
|
- Enh #11979: Added `yii\mutex\OracleMutex` which implements mutex "lock" mechanism via Oracle locks (zlakomanoff)
|
||||||
- Enh #12082: Used `jQuery.on(` instead of event method to ensure forwards compatibility (newerton)
|
- Enh #12082: Used `jQuery.on(` instead of event method to ensure forwards compatibility (newerton)
|
||||||
|
- Enh #12028: Add -h|--help option to console command to display help information (pana1990)
|
||||||
|
|
||||||
2.0.9 July 11, 2016
|
2.0.9 July 11, 2016
|
||||||
-------------------
|
-------------------
|
||||||
|
|||||||
@ -51,7 +51,11 @@ class Controller extends \yii\base\Controller
|
|||||||
* If not set, ANSI color will only be enabled for terminals that support it.
|
* If not set, ANSI color will only be enabled for terminals that support it.
|
||||||
*/
|
*/
|
||||||
public $color;
|
public $color;
|
||||||
|
/**
|
||||||
|
* @var boolean whether to display help information about current command.
|
||||||
|
* @since 2.0.10
|
||||||
|
*/
|
||||||
|
public $help;
|
||||||
/**
|
/**
|
||||||
* @var array the options passed during execution.
|
* @var array the options passed during execution.
|
||||||
*/
|
*/
|
||||||
@ -116,6 +120,10 @@ class Controller extends \yii\base\Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->help) {
|
||||||
|
$route = $this->id . '/' . $id;
|
||||||
|
return Yii::$app->runAction('help', [$route]);
|
||||||
|
}
|
||||||
return parent::runAction($id, $params);
|
return parent::runAction($id, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,7 +311,7 @@ class Controller extends \yii\base\Controller
|
|||||||
public function options($actionID)
|
public function options($actionID)
|
||||||
{
|
{
|
||||||
// $actionId might be used in subclasses to provide options specific to action id
|
// $actionId might be used in subclasses to provide options specific to action id
|
||||||
return ['color', 'interactive'];
|
return ['color', 'interactive', 'help'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -318,7 +326,9 @@ class Controller extends \yii\base\Controller
|
|||||||
*/
|
*/
|
||||||
public function optionAliases()
|
public function optionAliases()
|
||||||
{
|
{
|
||||||
return [];
|
return [
|
||||||
|
'h' => 'help'
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user