mirror of
https://github.com/docker/compose.git
synced 2025-07-07 05:44:25 +02:00
Merge pull request #387 from dnephin/make_ps_work_on_jekins
tty width on jenkins
This commit is contained in:
commit
b690b0d20e
@ -4,11 +4,17 @@ import os
|
|||||||
import texttable
|
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):
|
class Formatter(object):
|
||||||
def table(self, headers, rows):
|
def table(self, headers, rows):
|
||||||
height, width = os.popen('stty size', 'r').read().split()
|
table = texttable.Texttable(max_width=get_tty_width())
|
||||||
|
|
||||||
table = texttable.Texttable(max_width=width)
|
|
||||||
table.set_cols_dtype(['t' for h in headers])
|
table.set_cols_dtype(['t' for h in headers])
|
||||||
table.add_rows([headers] + rows)
|
table.add_rows([headers] + rows)
|
||||||
table.set_deco(table.HEADER)
|
table.set_deco(table.HEADER)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user