Doccomment can now override context command name

This commit is contained in:
Chris 2016-11-01 16:19:38 +01:00
parent ae17abb6c1
commit 81dea747b2
2 changed files with 4 additions and 2 deletions

View File

@ -17,6 +17,7 @@ class MyCommand extends Command
class MyContext extends Context
{
/**
* @command testme
* @args
* @help Useful test!
*/

View File

@ -41,7 +41,8 @@ class Context
$info[$key] = $value;
}
if (count($info)>0) {
$this->addCommand($method->getName(), [$this, $method->getName()], $info);
$cmdName = array_key_exists("command",$info)?$info["command"]:$method->getName();
$this->addCommand($cmdName, [$this, $method->getName()], $info);
}
}
}
@ -128,4 +129,4 @@ class Context
return $this->data;
}
}
}