Add an override to colify so we can set terminal dimensions.
This commit is contained in:
parent
065e5ccd1a
commit
d49c98188a
@ -48,9 +48,7 @@
|
||||
|
||||
# Set an environment variable so that colify will print output like it would to
|
||||
# a terminal.
|
||||
os.environ['COLIFY_TTY'] = 'true'
|
||||
os.environ['COLUMNS'] = '80'
|
||||
os.environ['LINES'] = '25'
|
||||
os.environ['COLIFY_SIZE'] = '25x80'
|
||||
|
||||
# Enable todo items
|
||||
todo_include_todos = True
|
||||
|
@ -169,6 +169,15 @@ def colify(elts, **options):
|
||||
if not elts:
|
||||
return (0, ())
|
||||
|
||||
# environment size is of the form "<rows>x<cols>"
|
||||
env_size = os.environ.get('COLIFY_SIZE')
|
||||
if env_size:
|
||||
try:
|
||||
r, c = env_size.split('x')
|
||||
console_rows, console_cols = int(r), int(c)
|
||||
tty = True
|
||||
except: pass
|
||||
|
||||
# Use only one column if not a tty.
|
||||
if not tty:
|
||||
if tty is False or not output.isatty():
|
||||
|
Loading…
Reference in New Issue
Block a user