Ejemplo n.º 1
0
def print_list_in_columns(lst):
    """
    This function is currently only intended for environmant names,
    which are guaranteed to be 23 characters or less.
    :param lst: List of env names
    """
    if sys.stdout.isatty():
        lst = list_to_columns(lst)
        for x in range(0, len(lst[0])):
            line = []
            for i in range(0, len(lst)):
                try:
                    line.append(lst[i][x])
                except IndexError:
                    pass

            io.echo_and_justify(42, *line)
    else:
        for i in lst:
            io.echo(i)
Ejemplo n.º 2
0
def print_list_in_columns(lst):
    """
    This function is currently only intended for environmant names,
    which are guaranteed to be 23 characters or less.
    :param lst: List of env names
    """
    if sys.stdout.isatty():
        lst = list_to_columns(lst)
        index = 0
        for x in range(0, len(lst[0])):
            line = []
            for i in range(0, len(lst)):
                try:
                    line.append(lst[i][x])
                except IndexError:
                    pass

            io.echo_and_justify(42, *line)
    else:
        # Dont print in columns if using pipe
        for i in lst:
            io.echo(i)
Ejemplo n.º 3
0
    def test_echo_and_justify(self, print_mock):
        io.echo_and_justify(4, 'how ', 'now ', 'brown ', 'cow ')

        print_mock.assert_called_once_with('how now brown cow')