mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 13:02:24 +08:00
Fixes #16217: Fixed yii\console\controllers\HelpController to work well in Windows environment
This commit is contained in:
committed by
GitHub
parent
1945dc69c7
commit
e4b559d720
@ -116,13 +116,13 @@ class HelpController extends Controller
|
||||
}
|
||||
|
||||
foreach ($controller->getActionArgsHelp($action) as $argument => $help) {
|
||||
$description = str_replace("\n", '', addcslashes($help['comment'], ':')) ?: $argument;
|
||||
$description = preg_replace("~\R~", '', addcslashes($help['comment'], ':')) ?: $argument;
|
||||
$this->stdout($argument . ':' . $description . "\n");
|
||||
}
|
||||
|
||||
$this->stdout("\n");
|
||||
foreach ($controller->getActionOptionsHelp($action) as $argument => $help) {
|
||||
$description = str_replace("\n", '', addcslashes($help['comment'], ':'));
|
||||
$description = preg_replace("~\R~", '', addcslashes($help['comment'], ':'));
|
||||
$this->stdout('--' . $argument . ($description ? ':' . $description : '') . "\n");
|
||||
}
|
||||
}
|
||||
@ -251,16 +251,16 @@ class HelpController extends Controller
|
||||
$file = $matches[0];
|
||||
$relativePath = str_replace($controllerPath, '', $file);
|
||||
$class = strtr($relativePath, [
|
||||
DIRECTORY_SEPARATOR => '\\',
|
||||
'/' => '\\',
|
||||
'.php' => '',
|
||||
]);
|
||||
$controllerClass = $module->controllerNamespace . $class;
|
||||
if ($this->validateControllerClass($controllerClass)) {
|
||||
$dir = ltrim(pathinfo($relativePath, PATHINFO_DIRNAME), DIRECTORY_SEPARATOR);
|
||||
$dir = ltrim(pathinfo($relativePath, PATHINFO_DIRNAME), '\\/');
|
||||
|
||||
$command = Inflector::camel2id(substr(basename($file), 0, -14), '-', true);
|
||||
if (!empty($dir)) {
|
||||
$command = $dir . DIRECTORY_SEPARATOR . $command;
|
||||
$command = $dir . '/' . $command;
|
||||
}
|
||||
$commands[] = $prefix . $command;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user