Add basic CLI
This commit is contained in:
parent
523fb99d79
commit
3b654ad349
10 changed files with 266 additions and 1 deletions
15
plum/cli/formatter.py
Normal file
15
plum/cli/formatter.py
Normal 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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue