diff --git a/src/Commando/Command.php b/src/Commando/Command.php index 26b494e..9650d2c 100755 --- a/src/Commando/Command.php +++ b/src/Commando/Command.php @@ -489,9 +489,16 @@ public function parse() // todo protect against duplicates caused by aliases foreach ($this->options as $option) { if (is_null($option->getValue()) && $option->isRequired()) { - throw new \Exception(sprintf('Required %s %s must be specified', - $option->getType() & Option::TYPE_NAMED ? - 'option' : 'argument', $option->getName())); + $name = $option->getName(); + if ($option->getType() & Option::TYPE_NAMED) { + $nature = 'option'; + } else { + $nature = 'argument'; + if ($title = $option->getTitle()) { + $name = $title; + } + } + throw new \Exception(sprintf('Required %s %s must be specified', $nature, $name)); } } diff --git a/src/Commando/Option.php b/src/Commando/Option.php index aad7def..ee973fd 100755 --- a/src/Commando/Option.php +++ b/src/Commando/Option.php @@ -320,6 +320,14 @@ public function getAliases() return $this->aliases; } + /** + * @return string title of the option + */ + public function getTitle() + { + return $this->title; + } + /** * Get the current set of this option's requirements * @return string[] List of required options