Created
September 12, 2017 23:37
-
-
Save inxomnyaa/b2944b2e425b77b4a9feab55e33335a6 to your computer and use it in GitHub Desktop.
customui dynamic subcommand overview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function registerUIs(){ | |
$ui = new SimpleForm($this->getDescription()->getPrefix() . TextFormat::DARK_PURPLE . ' Commands', 'These are all ' . $this->getDescription()->getPrefix() . ' commands:'); | |
$namespace = __NAMESPACE__. '\subcommand\\'; | |
print $namespace; | |
foreach (\get_declared_classes() as $class){ | |
if (strpos($class, $namespace) === 0){ | |
$c = substr($class, strlen($namespace)); | |
$c = str_replace('SubCommand', '', $c); | |
if (strlen($c) > 0){ | |
$ui->addButton(new Button(TextFormat::DARK_GREEN . $c)); | |
} | |
} | |
} | |
self::$uis['commands'] = UIAPI::addUI($this, $ui); | |
/* ********* */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment