Add an override to colify so we can set terminal dimensions.

This commit is contained in:
Todd Gamblin
2015-02-22 21:17:18 -08:00
parent 065e5ccd1a
commit d49c98188a
2 changed files with 10 additions and 3 deletions

View File

@@ -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():