mirror of
https://github.com/hauke68/Magallanes.git
synced 2025-09-16 13:50:17 +02:00
Enable running help command in Console
This commit is contained in:
parent
342a468214
commit
fb236c1bb3
@ -13,6 +13,7 @@ namespace Mage;
|
|||||||
use Mage\Command\Factory;
|
use Mage\Command\Factory;
|
||||||
use Mage\Command\RequiresEnvironment;
|
use Mage\Command\RequiresEnvironment;
|
||||||
use Mage\Console\Colors;
|
use Mage\Console\Colors;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use RecursiveDirectoryIterator;
|
use RecursiveDirectoryIterator;
|
||||||
use SplFileInfo;
|
use SplFileInfo;
|
||||||
@ -94,6 +95,7 @@ class Console
|
|||||||
try {
|
try {
|
||||||
// Load configuration
|
// Load configuration
|
||||||
$config->load($arguments);
|
$config->load($arguments);
|
||||||
|
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
$configError = $exception->getMessage();
|
$configError = $exception->getMessage();
|
||||||
}
|
}
|
||||||
@ -117,6 +119,7 @@ class Console
|
|||||||
if ($showGreetings) {
|
if ($showGreetings) {
|
||||||
if (!self::$logEnabled) {
|
if (!self::$logEnabled) {
|
||||||
self::output('Starting <blue>Magallanes</blue>', 0, 2);
|
self::output('Starting <blue>Magallanes</blue>', 0, 2);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
self::output('Starting <blue>Magallanes</blue>', 0, 1);
|
self::output('Starting <blue>Magallanes</blue>', 0, 1);
|
||||||
self::log("Logging enabled");
|
self::log("Logging enabled");
|
||||||
@ -127,15 +130,20 @@ class Console
|
|||||||
// Run Command - Check if there is a Configuration Error
|
// Run Command - Check if there is a Configuration Error
|
||||||
if ($configError !== false) {
|
if ($configError !== false) {
|
||||||
self::output('<red>' . $configError . '</red>', 1, 2);
|
self::output('<red>' . $configError . '</red>', 1, 2);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Run Command and check for Command Requirements
|
// Run Command and check for Command Requirements
|
||||||
try {
|
try {
|
||||||
$command = Factory::get($commandName, $config);
|
$command = Factory::get($commandName, $config);
|
||||||
|
|
||||||
if ($command instanceof RequiresEnvironment) {
|
if ($config->getParameter('help')) {
|
||||||
if ($config->getEnvironment() === false) {
|
self::output($command->getInfoMessage(), 2);
|
||||||
throw new Exception('You must specify an environment for this command.');
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($command instanceof RequiresEnvironment && $config->getEnvironment() === false) {
|
||||||
|
throw new Exception('You must specify an environment for this command.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the Command
|
// Run the Command
|
||||||
@ -306,4 +314,5 @@ class Console
|
|||||||
|| self::$config->general('verbose_logging')
|
|| self::$config->general('verbose_logging')
|
||||||
|| self::$config->environmentConfig('verbose_logging', false);
|
|| self::$config->environmentConfig('verbose_logging', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user