Add basic CLI

This commit is contained in:
Ben Firshman 2013-12-11 14:25:32 +00:00
commit 3b654ad349
10 changed files with 266 additions and 1 deletions

15
plum/cli/formatter.py Normal file
View file

@ -0,0 +1,15 @@
import texttable
import os
class Formatter(object):
def table(self, headers, rows):
height, width = os.popen('stty size', 'r').read().split()
table = texttable.Texttable(max_width=width)
table.set_cols_dtype(['t' for h in headers])
table.add_rows([headers] + rows)
table.set_deco(table.HEADER)
table.set_chars(['-', '|', '+', '-'])
return table.draw()