def load_help_files(data):
    """ loads all the extra information from help files """
    for command_name, help_yaml in helps.items():

        help_entry = yaml.safe_load(help_yaml)
        try:
            help_type = help_entry['type']
        except KeyError:
            continue

        # if there is extra help for this command but it's not reflected in the command table
        if command_name not in data and help_type == 'command':
            logger.debug('Command: %s not found in command table', command_name)
            continue

        short_summary = help_entry.get('short-summary')
        if short_summary and help_type == 'command':
            data[command_name]['help'] = short_summary
        else:
            # must be a command group or sub-group
            data[command_name] = {'help': short_summary}
            continue

        if 'parameters' in help_entry:
            for param in help_entry['parameters']:
                # this could fail if the help file and options list are not in the same order
                param_name = param['name'].split()[0]

                if param_name not in data[command_name]['parameters']:
                    logger.debug('Command %s does not have parameter: %s', command_name, param_name)
                    continue

                if 'short-summary' in param:
                    data[command_name]['parameters'][param_name]['help'] = param["short-summary"]

        if 'examples' in help_entry:
            data[command_name]['examples'] = [[example['name'], example['text']]
                                              for example in help_entry['examples']]
def load_help_files ( data ) : for command_name , help_yaml in helps . items ( ) : help_entry = yaml . safe_load ( help_yaml ) try : help_type = help_entry [ 'type' ] except KeyError : continue if command_name not in data and help_type == 'command' : logger . debug ( 'Command: %s not found in command table' , command_name ) continue short_summary = help_entry . get ( 'short-summary' ) if short_summary and help_type == 'command' : data [ command_name ] [ 'help' ] = short_summary else : data [ command_name ] = { 'help' : short_summary } continue if 'parameters' in help_entry : for param in help_entry [ 'parameters' ] : param_name = param [ 'name' ] . split ( ) [ 0 ] if param_name not in data [ command_name ] [ 'parameters' ] : logger . debug ( 'Command %s does not have parameter: %s' , command_name , param_name ) continue if 'short-summary' in param : data [ command_name ] [ 'parameters' ] [ param_name ] [ 'help' ] = param [ "short-summary" ] if 'examples' in help_entry : data [ command_name ] [ 'examples' ] = [ [ example [ 'name' ] , example [ 'text' ] ] for example in help_entry [ 'examples' ] ]
loads all the extra information from help files