diff --git a/Mage/Console.php b/Mage/Console.php
index d9fcbb2..ef29492 100644
--- a/Mage/Console.php
+++ b/Mage/Console.php
@@ -13,6 +13,7 @@ namespace Mage;
use Mage\Command\Factory;
use Mage\Command\RequiresEnvironment;
use Mage\Console\Colors;
+
use Exception;
use RecursiveDirectoryIterator;
use SplFileInfo;
@@ -94,6 +95,7 @@ class Console
try {
// Load configuration
$config->load($arguments);
+
} catch (Exception $exception) {
$configError = $exception->getMessage();
}
@@ -117,6 +119,7 @@ class Console
if ($showGreetings) {
if (!self::$logEnabled) {
self::output('Starting Magallanes', 0, 2);
+
} else {
self::output('Starting Magallanes', 0, 1);
self::log("Logging enabled");
@@ -127,15 +130,20 @@ class Console
// Run Command - Check if there is a Configuration Error
if ($configError !== false) {
self::output('' . $configError . '', 1, 2);
+
} else {
// Run Command and check for Command Requirements
try {
$command = Factory::get($commandName, $config);
- if ($command instanceof RequiresEnvironment) {
- if ($config->getEnvironment() === false) {
- throw new Exception('You must specify an environment for this command.');
- }
+ if ($config->getParameter('help')) {
+ self::output($command->getInfoMessage(), 2);
+
+ return 0;
+ }
+
+ if ($command instanceof RequiresEnvironment && $config->getEnvironment() === false) {
+ throw new Exception('You must specify an environment for this command.');
}
// Run the Command
@@ -306,4 +314,5 @@ class Console
|| self::$config->general('verbose_logging')
|| self::$config->environmentConfig('verbose_logging', false);
}
+
}