summaryrefslogtreecommitdiff
path: root/lib/spack/llnl/util/tty
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-10-08 03:07:54 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2014-10-08 03:08:40 -0700
commit36a87f5bf9884978ba1f672322d9b7f663cf4f58 (patch)
tree34e3961ca60d9899cd8cd1f26489b9a823342f39 /lib/spack/llnl/util/tty
parent319b37af0ea84a6ba88d9a6b3a71f17b35c7f0f5 (diff)
downloadspack-36a87f5bf9884978ba1f672322d9b7f663cf4f58.tar.gz
spack-36a87f5bf9884978ba1f672322d9b7f663cf4f58.tar.bz2
spack-36a87f5bf9884978ba1f672322d9b7f663cf4f58.tar.xz
spack-36a87f5bf9884978ba1f672322d9b7f663cf4f58.zip
Update documentation to add an auto-generated list of packages.
Diffstat (limited to 'lib/spack/llnl/util/tty')
-rw-r--r--lib/spack/llnl/util/tty/colify.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/spack/llnl/util/tty/colify.py b/lib/spack/llnl/util/tty/colify.py
index 5586b2681a..ff06241937 100644
--- a/lib/spack/llnl/util/tty/colify.py
+++ b/lib/spack/llnl/util/tty/colify.py
@@ -109,13 +109,15 @@ def colify(elts, **options):
# elts needs to be an array of strings so we can count the elements
elts = [str(elt) for elt in elts]
if not elts:
- return
+ return (0, ())
if not tty:
if tty is False or not isatty(output):
for elt in elts:
output.write("%s\n" % elt)
- return
+
+ maxlen = max(len(str(s)) for s in elts)
+ return (1, (maxlen,))
console_cols = options.get("cols", None)
if not console_cols:
@@ -150,6 +152,8 @@ def colify(elts, **options):
if row == rows_last_col:
cols -= 1
+ return (config.cols, tuple(config.widths))
+
def colified(elts, **options):
"""Invokes the colify() function but returns the result as a string