Skip to content
Snippets Groups Projects
Commit d49c9818 authored by Todd Gamblin's avatar Todd Gamblin
Browse files

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

parent 065e5ccd
No related branches found
No related tags found
No related merge requests found
...@@ -48,9 +48,7 @@ ...@@ -48,9 +48,7 @@
# Set an environment variable so that colify will print output like it would to # Set an environment variable so that colify will print output like it would to
# a terminal. # a terminal.
os.environ['COLIFY_TTY'] = 'true' os.environ['COLIFY_SIZE'] = '25x80'
os.environ['COLUMNS'] = '80'
os.environ['LINES'] = '25'
# Enable todo items # Enable todo items
todo_include_todos = True todo_include_todos = True
......
...@@ -169,6 +169,15 @@ def colify(elts, **options): ...@@ -169,6 +169,15 @@ def colify(elts, **options):
if not elts: if not elts:
return (0, ()) 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. # Use only one column if not a tty.
if not tty: if not tty:
if tty is False or not output.isatty(): if tty is False or not output.isatty():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment