Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
a2c1148c52 | |||
81dea747b2 |
@ -17,6 +17,7 @@ class MyCommand extends Command
|
|||||||
class MyContext extends Context
|
class MyContext extends Context
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* @command testme
|
||||||
* @args
|
* @args
|
||||||
* @help Useful test!
|
* @help Useful test!
|
||||||
*/
|
*/
|
||||||
|
@ -41,7 +41,8 @@ class Context
|
|||||||
$info[$key] = $value;
|
$info[$key] = $value;
|
||||||
}
|
}
|
||||||
if (count($info)>0) {
|
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;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -199,10 +199,12 @@ class Shell
|
|||||||
{
|
{
|
||||||
switch ($command) {
|
switch ($command) {
|
||||||
case '.':
|
case '.':
|
||||||
printf("context<%s>: %s\n", $this->context->getName(), json_encode($this->context->getData()));
|
$type = basename(strtr(get_class($this->context), "\\", "/"));
|
||||||
|
printf("%s<%s>: %s\n", $type, $this->context->getName(), json_encode($this->context->getData()));
|
||||||
$level = 0;
|
$level = 0;
|
||||||
foreach ($this->contextStack as $context) {
|
foreach ($this->contextStack as $context) {
|
||||||
printf(" %s- context<%s>\n", str_repeat(" ",$level++), $context->getName());
|
$type = basename(strtr(get_class($context), "\\", "/"));
|
||||||
|
printf(" %s- %s<%s>\n", str_repeat(" ",$level++), $type, $context->getName());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '..':
|
case '..':
|
||||||
|
Reference in New Issue
Block a user