@@ -81,9 +81,11 @@ public static function getInfo($cmd) {
8181 if ($ cmd != null ) {
8282 foreach ($ commands as $ command ) {
8383 if ($ command ->getName () == $ cmd ) {
84- $ result [] = [
85- "info " => "Command <b> {$ cmd }</b> find by name " ,
86- "cmd " => $ command
84+ return [
85+ [
86+ "info " => "Command <b> {$ cmd }</b> find by name " ,
87+ "cmd " => $ command
88+ ]
8789 ];
8890 } elseif (array_search ($ cmd , $ command ->getAliases ()) !== false ) {
8991 $ result [] = [
@@ -516,9 +518,7 @@ public static function newMail() {
516518 public static function createCommand () {
517519 return new Command ("create-command " , "commandName " , "Creates a new custom command for the devtools. " , [
518520 "create:command " ,
519- 'add:command ' ,
520- 'addCommand ' ,
521- 'add-command '
521+ 'createCommand '
522522 ], [
523523 "v " => Parameter::create ("value " , "The command value (first parameter). " , []),
524524 "p " => Parameter::create ("parameters " , "The command parameters (comma separated). " , []),
@@ -556,6 +556,13 @@ public static function getCustomCommands() {
556556 return self ::$ customCommands ;
557557 }
558558
559+ public static function reloadCustomCommands (array $ config = []) {
560+ self ::$ customCommands = null ;
561+ self ::$ customAliases = [];
562+ self ::preloadCustomCommands ($ config );
563+ self ::getCustomCommands ();
564+ }
565+
559566 public static function getCustomAliases () {
560567 return self ::$ customAliases ;
561568 }
@@ -564,7 +571,7 @@ public static function preloadCustomCommands(array $config = []) {
564571 $ config ['cmd-pattern ' ] ??= 'commands ' . \DS . '*.cmd.php ' ;
565572 $ files = UFileSystem::glob_recursive ($ config ['cmd-pattern ' ]);
566573 foreach ($ files as $ file ) {
567- include $ file ;
574+ include_once $ file ;
568575 }
569576 }
570577
0 commit comments