We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 1346805 + b0f398c commit b690b0dCopy full SHA for b690b0d
1 file changed
fig/cli/formatter.py
@@ -4,11 +4,17 @@
4
import texttable
5
6
7
+def get_tty_width():
8
+ tty_size = os.popen('stty size', 'r').read().split()
9
+ if len(tty_size) != 2:
10
+ return 80
11
+ _, width = tty_size
12
+ return width
13
+
14
15
class Formatter(object):
16
def table(self, headers, rows):
- height, width = os.popen('stty size', 'r').read().split()
-
- table = texttable.Texttable(max_width=width)
17
+ table = texttable.Texttable(max_width=get_tty_width())
18
table.set_cols_dtype(['t' for h in headers])
19
table.add_rows([headers] + rows)
20
table.set_deco(table.HEADER)
0 commit comments