diff options
author | Erik Rose <erik@mozilla.com> | 2013-08-30 16:29:51 -0400 |
---|---|---|
committer | Erik Rose <erik@mozilla.com> | 2013-08-30 16:29:51 -0400 |
commit | 9520394149dc18bf83e3c11877d50f3b2cd27dff (patch) | |
tree | 59a303a6ba624943461b049d6cbd2ae58b79a874 /README.rst | |
parent | e899c7241d82dd350ed90b3d90706b40139a9171 (diff) | |
download | blessings-9520394149dc18bf83e3c11877d50f3b2cd27dff.tar.gz |
Make does_styling attr public. Bump version to 1.6.
This is more often what's intended when is_a_tty is examined. While a caller could keep track of what he's passed to the Terminal constructor, it is often more convenient to have the info available directly on the instance, which we're already passing around everywhere.
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -375,15 +375,15 @@ If you want to override this--like if you anticipate your program being piped through ``less -r``, which handles terminal escapes just fine--pass ``force_styling=True`` to the ``Terminal`` constructor. -In any case, there is an ``is_a_tty`` attribute on ``Terminal`` that lets you -see whether the attached stream seems to be a terminal. If it's false, you -might refrain from drawing progress bars and other frippery, since you're -apparently headed into a pipe:: +In any case, there is a ``does_styling`` attribute on ``Terminal`` that lets +you see whether your capabilities will return actual, working formatting codes. +If it's false, you should refrain from drawing progress bars and other frippery +and just stick to content, since you're apparently headed into a pipe:: from blessings import Terminal term = Terminal() - if term.is_a_tty: + if term.does_styling: with term.location(0, term.height - 1): print 'Progress: [=======> ]' print term.bold('Important stuff') @@ -433,6 +433,10 @@ Blessings is under the MIT License. See the LICENSE file. Version History =============== +1.6 + * Add ``does_styling`` attribute. This takes ``force_styling`` into account + and should replace most uses of ``is_a_tty``. + 1.5.1 * Clean up fabfile, removing the redundant ``test`` command. * Add Travis support. |