mirror of https://github.com/docker/compose.git
Resolves #386, tty width on jenkins
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
parent
0a15e7fe9c
commit
b0f398caaa
|
@ -4,11 +4,17 @@ import os
|
|||
import texttable
|
||||
|
||||
|
||||
def get_tty_width():
|
||||
tty_size = os.popen('stty size', 'r').read().split()
|
||||
if len(tty_size) != 2:
|
||||
return 80
|
||||
_, width = tty_size
|
||||
return width
|
||||
|
||||
|
||||
class Formatter(object):
|
||||
def table(self, headers, rows):
|
||||
height, width = os.popen('stty size', 'r').read().split()
|
||||
|
||||
table = texttable.Texttable(max_width=width)
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue