示例#1
0
def order_by(field_name):
    """ this function sorts the result list (reverse order if sorted already)
    :param field_name:
    """
    if len(pycsverter.result_list) == 0:
        Console.print_red('Parsed result not found, reloading...')
        load()
    if field_name in pycsverter.result_list[0]:
        Console.print_yellow('Sorting list by {}'.format(field_name))
        pycsverter.result_list.sort(key=lambda x: x[field_name])
        Console.print_green('Done!')
    else:
        Console.print_red('Field {} not in result list:')
        Console.print_blue('Fields available:')
        for k in pycsverter.result_list[0]:
            Console.print_blue(k)
示例#2
0
def print_outputs():
    """ Prints the accepted/configured outputs """
    Console.print_green('Output supported:')
    for output in config['output_formats']:
        Console.print_blue(output)
示例#3
0
def results_info():
    """ prints info about the result list """
    if len(pycsverter.result_list) == 0:
        Console.print_red('Parsed result not found...run: load')
    else:
        Console.print_blue('List of {} elements'.format(len(pycsverter.result_list)))