From 7937611366f58d5d1d5a87cb973b72ec492b2e6e Mon Sep 17 00:00:00 2001 From: Erik Kristensen Date: Tue, 14 Jul 2015 12:30:54 -0600 Subject: [PATCH] change 80 to 0 Signed-off-by: Erik Kristensen --- compose/cli/formatter.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/compose/cli/formatter.py b/compose/cli/formatter.py index 765659dd1..b5b0b3c03 100644 --- a/compose/cli/formatter.py +++ b/compose/cli/formatter.py @@ -3,9 +3,18 @@ from __future__ import absolute_import import os import texttable + +def get_tty_width(): + tty_size = os.popen('stty size', 'r').read().split() + if len(tty_size) != 2: + return 0 + _, width = tty_size + return int(width) + + class Formatter(object): def table(self, headers, rows): - table = texttable.Texttable(max_width=0) + table = texttable.Texttable(max_width=get_tty_width()) table.set_cols_dtype(['t' for h in headers]) table.add_rows([headers] + rows) table.set_deco(table.HEADER)