@@ -664,7 +664,7 @@ private function registerExtendCommands()
664
664
->loadExtendConfiguration ();
665
665
}
666
666
667
- public function getData ()
667
+ public function getData ($ filterNamespaces = null , $ excludeNamespaces = [], $ excludeChainCommands = false )
668
668
{
669
669
$ singleCommands = [
670
670
'about ' ,
@@ -693,9 +693,16 @@ public function getData()
693
693
return (strpos ($ item , ': ' )<=0 );
694
694
}
695
695
);
696
+
696
697
sort ($ namespaces );
697
698
array_unshift ($ namespaces , 'misc ' );
698
699
700
+ // Exclude specific namespaces
701
+ $ namespaces = array_diff ($ namespaces , $ excludeNamespaces );
702
+
703
+ // filter namespaces if available
704
+ if ($ filterNamespaces ) $ namespaces = array_intersect ($ namespaces , $ filterNamespaces );
705
+
699
706
foreach ($ namespaces as $ namespace ) {
700
707
$ commands = $ this ->all ($ namespace );
701
708
usort (
@@ -705,6 +712,11 @@ public function getData()
705
712
);
706
713
707
714
foreach ($ commands as $ command ) {
715
+ // Exclude command if is a chain command and was requested to exclude chain commands
716
+ if ($ excludeChainCommands && $ command instanceof ChainCustomCommand) {
717
+ continue ;
718
+ }
719
+
708
720
if (method_exists ($ command , 'getModule ' )) {
709
721
if ($ command ->getModule () == 'Console ' ) {
710
722
$ data ['commands ' ][$ namespace ][] = $ this ->commandData (
@@ -719,6 +731,11 @@ public function getData()
719
731
}
720
732
}
721
733
734
+ // Remove namepsaces without commands
735
+ $ namespaces = array_filter ($ namespaces , function ($ namespace ) use ( $ data ) {
736
+ return count ($ data ['commands ' ][$ namespace ]) > 0 ;
737
+ });
738
+
722
739
$ input = $ this ->getDefinition ();
723
740
$ options = [];
724
741
foreach ($ input ->getOptions () as $ option ) {
0 commit comments