def draw_header_row()

in ebcli/display/table.py [0:0]


    def draw_header_row(self):
        t = term.get_terminal()
        labels = [' ']
        width = self.width
        for c in [0] + list(range(self.first_column, len(self.columns))):
            column = self.columns[c]
            column_size = column.size
            if column_size is None:
                column_size = self.get_widest_data_length_in_column(self.columns[c]) + 2
                # special case for Description column this should be the same for all
                # description columns, allows very large descriptions that we are able
                # to scroll through.
                if column.name == 'Description' and column_size > self.MAX_DESCRIPTION:
                    column_size = self.MAX_DESCRIPTION
                column.fit_size = column_size
            header = justify_and_trim(column.name, column_size, column.justify)
            if (self.screen.sort_index and
                    self.screen.sort_index[1] == c and  # Sort column
                    self.name == self.screen.sort_index[0] and  # sort table
                    len(' '.join(labels)) < width):  # Column is on screen
                format_string = '{n}{b}{u}{data}{n}{r}'
                header = format_string.replace('{data}', header)
                width += len(format_string) - 6
            labels.append(header)

        header_text = justify_and_trim(' '.join(labels), width, 'left')

        # header title
        if header_text[-Table.HEADER_SPACE_NEEDED:].isspace():
            header_text = (header_text[:-Table.HEADER_SPACE_NEEDED] + '  {n}{b} ' +
                           justify_and_trim(self.name, Table.HEADER_WIDTH, 'right') + ' {r} ')
        header_text = header_text.format(n=t.normal, b=t.bold, u=term.underline(),
                                         r=term.reverse_())
        header_text += t.normal

        term.echo_line(term.reverse_colors(header_text))