@@ -324,8 +324,9 @@ def HelpTextForObject(component, info, trace=None, verbose=False):
324324 possible_flags = ''
325325
326326 if groups :
327- # TODO(joejoevictor): Add missing GROUPS section handling
328327 possible_actions .append ('GROUP' )
328+ usage_details_section = GroupUsageDetailsSection (groups )
329+ usage_details_sections .append (usage_details_section )
329330 if commands :
330331 possible_actions .append ('COMMAND' )
331332 usage_details_section = CommandUsageDetailsSection (commands )
@@ -362,6 +363,36 @@ def HelpTextForObject(component, info, trace=None, verbose=False):
362363 )
363364
364365
366+ def GroupUsageDetailsSection (groups ):
367+ """Creates a section tuple for the groups section of the usage details."""
368+ group_item_strings = []
369+ for group_name , group in groups :
370+ group_info = inspectutils .Info (group )
371+ group_item = group_name
372+ if 'docstring_info' in group_info :
373+ group_docstring_info = group_info ['docstring_info' ]
374+ if group_docstring_info and group_docstring_info .summary :
375+ group_item = _CreateItem (group_name ,
376+ group_docstring_info .summary )
377+ group_item_strings .append (group_item )
378+ return ('GROUPS' , _NewChoicesSection ('GROUP' , group_item_strings ))
379+
380+
381+ def CommandUsageDetailsSection (commands ):
382+ """Creates a section tuple for the commands section of the usage details."""
383+ command_item_strings = []
384+ for command_name , command in commands :
385+ command_info = inspectutils .Info (command )
386+ command_item = command_name
387+ if 'docstring_info' in command_info :
388+ command_docstring_info = command_info ['docstring_info' ]
389+ if command_docstring_info and command_docstring_info .summary :
390+ command_item = _CreateItem (command_name ,
391+ command_docstring_info .summary )
392+ command_item_strings .append (command_item )
393+ return ('COMMANDS' , _NewChoicesSection ('COMMAND' , command_item_strings ))
394+
395+
365396def ValuesUsageDetailsSection (component , values ):
366397 """Creates a section tuple for the values section of the usage details."""
367398 value_item_strings = []
@@ -379,24 +410,9 @@ def ValuesUsageDetailsSection(component, values):
379410 return ('VALUES' , _NewChoicesSection ('VALUE' , value_item_strings ))
380411
381412
382- def CommandUsageDetailsSection (commands ):
383- """Creates a section tuple for the commands section of the usage details."""
384- command_item_strings = []
385- for command_name , command in commands :
386- command_info = inspectutils .Info (command )
387- command_item = formatting .Bold (command_name )
388- if 'docstring_info' in command_info :
389- command_docstring_info = command_info ['docstring_info' ]
390- if command_docstring_info and command_docstring_info .summary :
391- command_item = _CreateItem (
392- formatting .Bold (command_name ), command_docstring_info .summary )
393- command_item_strings .append (command_item )
394- return ('COMMANDS' , _NewChoicesSection ('COMMAND' , command_item_strings ))
395-
396-
397413def _NewChoicesSection (name , choices ):
398414 return _CreateItem (
399- '{name} is one of the followings :' .format (
415+ '{name} is one of the following :' .format (
400416 name = formatting .Bold (formatting .Underline (name ))),
401417 '\n ' + '\n \n ' .join (choices ),
402418 indent = 1 )
0 commit comments