From bff9e1a8ef30f031717a1362488707464e03ca95 Mon Sep 17 00:00:00 2001 From: Andrs Montaez Date: Sat, 4 Feb 2012 15:45:28 -0200 Subject: [PATCH] Control when no action is provided. --- Mage/Console.php | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/Mage/Console.php b/Mage/Console.php index e8d219a..b661b56 100644 --- a/Mage/Console.php +++ b/Mage/Console.php @@ -18,30 +18,34 @@ class Mage_Console public function parse() { - if ($this->_args[0] == 'deploy') { - $this->_action = 'deploy'; + if (count($this->_args) == 0) { + return false; + } + + if ($this->_args[0] == 'deploy') { + $this->_action = 'deploy'; - } else if ($this->_args[0] == 'releases') { - $this->_action = 'releases'; + } else if ($this->_args[0] == 'releases') { + $this->_action = 'releases'; - } else if ($this->_args[0] == 'update') { - $this->_action = 'update'; + } else if ($this->_args[0] == 'update') { + $this->_action = 'update'; - } else if ($this->_args[0] == 'add') { - $this->_action = 'add'; + } else if ($this->_args[0] == 'add') { + $this->_action = 'add'; - } else if ($this->_args[0] == 'install') { - $this->_action = 'install'; + } else if ($this->_args[0] == 'install') { + $this->_action = 'install'; - } else if ($this->_args[0] == 'upgrade') { - $this->_action = 'upgrade'; + } else if ($this->_args[0] == 'upgrade') { + $this->_action = 'upgrade'; - } else if ($this->_args[0] == 'version') { - $this->_action = 'version'; + } else if ($this->_args[0] == 'version') { + $this->_action = 'version'; - } else if ($this->_args[0] == 'init') { - $this->_action = 'init'; - } + } else if ($this->_args[0] == 'init') { + $this->_action = 'init'; + } foreach ($this->_args as $argument) { if (preg_match('/to:[\w]+/i', $argument)) { @@ -176,6 +180,10 @@ class Mage_Console case 'version'; $this->showVersion(); break; + + default: + Mage_Console::output('Invalid action', 0, 2); + break; } if ($showGrettings) {