@@ -90,8 +90,18 @@ def get_parser(self) -> argparse.ArgumentParser:
90
90
add_help = True ,
91
91
formatter_class = argparse .ArgumentDefaultsHelpFormatter ,
92
92
)
93
- for flags , keywords in self .get_arguments ().items ():
94
- parser .add_argument (* flags , ** keywords )
93
+ if not hasattr (self , "constituents" ):
94
+ for flags , keywords in self .get_arguments ().items ():
95
+ parser .add_argument (* flags , ** keywords )
96
+ else :
97
+ for constituent in sorted (self .constituents , key = lambda x : x .description ):
98
+ subparser = parser .add_argument_group (title = constituent .description )
99
+ for flags , keywords in constituent .get_arguments ().items ():
100
+ try :
101
+ subparser .add_argument (* flags , ** keywords )
102
+ except argparse .ArgumentError :
103
+ # Constituent tree has duplicates -> flag has already been added, pass
104
+ pass
95
105
return parser
96
106
97
107
def reproduce_cli_args (self , args_ns ):
@@ -252,7 +262,7 @@ def handle_arguments(self, args, **kwargs):
252
262
class PluginArgumentParser (ParserBase ):
253
263
"""Parser for arguments coming from plugins"""
254
264
255
- DESCRIPTION = "Parse plugin CLI arguments and selections "
265
+ DESCRIPTION = "Plugin options "
256
266
FPRIME_CHOICES = {
257
267
"framing" : "fprime" ,
258
268
"communication" : "ip" ,
@@ -378,7 +388,7 @@ def handle_arguments(self, args, **kwargs):
378
388
class CommExtraParser (ParserBase ):
379
389
"""Parses extra communication arguments"""
380
390
381
- DESCRIPTION = "Process arguments needed to specify arguments for communication "
391
+ DESCRIPTION = "Communications options "
382
392
383
393
def get_arguments (self ) -> Dict [Tuple [str , ...], Dict [str , Any ]]:
384
394
"""Get arguments for the comm-layer parser"""
@@ -406,7 +416,7 @@ class LogDeployParser(ParserBase):
406
416
to end up in the proper place.
407
417
"""
408
418
409
- DESCRIPTION = "Process arguments needed to specify a logging "
419
+ DESCRIPTION = "Logging options "
410
420
411
421
def get_arguments (self ) -> Dict [Tuple [str , ...], Dict [str , Any ]]:
412
422
"""Return arguments to parse logging options"""
@@ -469,7 +479,7 @@ class MiddleWareParser(ParserBase):
469
479
however; it should be close enough.
470
480
"""
471
481
472
- DESCRIPTION = "Process arguments needed to specify a tool using the middleware "
482
+ DESCRIPTION = "Middleware options "
473
483
474
484
def get_arguments (self ) -> Dict [Tuple [str , ...], Dict [str , Any ]]:
475
485
"""Return arguments necessary to run a and connect to the GDS middleware"""
@@ -541,6 +551,8 @@ def handle_arguments(self, args, **kwargs):
541
551
class DictionaryParser (DetectionParser ):
542
552
"""Parser for deployments"""
543
553
554
+ DESCRIPTION = "Dictionary options"
555
+
544
556
def get_arguments (self ) -> Dict [Tuple [str , ...], Dict [str , Any ]]:
545
557
"""Arguments to handle deployments"""
546
558
return {
@@ -580,6 +592,8 @@ def handle_arguments(self, args, **kwargs):
580
592
class FileHandlingParser (ParserBase ):
581
593
"""Parser for deployments"""
582
594
595
+ DESCRIPTION = "File handling options"
596
+
583
597
def get_arguments (self ) -> Dict [Tuple [str , ...], Dict [str , Any ]]:
584
598
"""Arguments to handle deployments"""
585
599
@@ -684,7 +698,7 @@ class GdsParser(ParserBase):
684
698
Note: deployment can help in setting both dictionary and logs, but isn't strictly required.
685
699
"""
686
700
687
- DESCRIPTION = "Process arguments needed to specify a tool using the GDS "
701
+ DESCRIPTION = "GUI options "
688
702
689
703
def get_arguments (self ) -> Dict [Tuple [str , ...], Dict [str , Any ]]:
690
704
"""Return arguments necessary to run a binary deployment via the GDS"""
@@ -731,7 +745,7 @@ class BinaryDeployment(DetectionParser):
731
745
and represents the flight-side of the equation.
732
746
"""
733
747
734
- DESCRIPTION = "Process arguments needed for running F prime binary"
748
+ DESCRIPTION = "FPrime binary options "
735
749
736
750
def get_arguments (self ) -> Dict [Tuple [str , ...], Dict [str , Any ]]:
737
751
"""Return arguments necessary to run a binary deployment via the GDS"""
@@ -777,7 +791,7 @@ class SearchArgumentsParser(ParserBase):
777
791
"""Parser for search arguments"""
778
792
779
793
DESCRIPTION = (
780
- "Process arguments relevant to searching/ filtering Channels/Events/Commands "
794
+ "Searching and filtering options "
781
795
)
782
796
783
797
def __init__ (self , command_name : str ) -> None :
@@ -823,7 +837,7 @@ def handle_arguments(self, args, **kwargs):
823
837
class RetrievalArgumentsParser (ParserBase ):
824
838
"""Parser for retrieval arguments"""
825
839
826
- DESCRIPTION = "Process arguments relevant to retrieving Channels/Events "
840
+ DESCRIPTION = "Data retrieval options "
827
841
828
842
def __init__ (self , command_name : str ) -> None :
829
843
self .command_name = command_name
0 commit comments