def print_rows(rows): fields = ['name', 'enabled'] field_labels = ['Name', 'Enabled'] if CONF.command.details: fields.extend(['server_type', 'os', 'coe']) field_labels.extend(['Server_Type', 'OS', 'COE']) if CONF.command.paths: fields.append('path') field_labels.append('Template Path') formatters = {key: operator.itemgetter(key) for key in fields} cliutils.print_list(rows, fields, formatters=formatters, field_labels=field_labels)
def print_rows(rows): fields = ['name', 'enabled'] field_labels = ['Name', 'Enabled'] if CONF.command.details: fields.extend(['platform', 'os', 'coe']) field_labels.extend(['Platform', 'OS', 'COE']) if CONF.command.paths: fields.append('path') field_labels.append('Template Path') formatters = dict((key, operator.itemgetter(key)) for key in fields) cliutils.print_list(rows, fields, formatters=formatters, field_labels=field_labels)
def print_rows(rows): fields = ['name', 'enabled'] field_labels = ['Name', 'Enabled'] if CONF.command.details: fields.extend(['server_type', 'os', 'coe']) field_labels.extend(['Server_Type', 'OS', 'COE']) if CONF.command.paths: fields.append('path') field_labels.append('Template Path') formatters = dict((key, operator.itemgetter(key)) for key in fields) cliutils.print_list(rows, fields, formatters=formatters, field_labels=field_labels)