summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-08-31 16:23:17 +0100
committerLars Wirzenius <liw@liw.fi>2011-08-31 16:23:17 +0100
commit0d93553e914d8aeb7eaf5d903f2d082ee7ec5a83 (patch)
tree733933243d5ed09a9f6b957b71e9f5379135ca55
parent8420760a2b335732c9f5bc63623fa0ed08e1319a (diff)
downloadpython-ttystatus-0d93553e914d8aeb7eaf5d903f2d082ee7ec5a83.tar.gz
Update docs to show example of .format() usage.
-rw-r--r--doc/index.rst7
-rw-r--r--example.py7
2 files changed, 4 insertions, 10 deletions
diff --git a/doc/index.rst b/doc/index.rst
index 5f671bf..7119d5d 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -25,11 +25,8 @@ Here's an example program that searches for symlinks in a directory tree::
import ttystatus
ts = ttystatus.TerminalStatus(period=0.1)
- ts.add(ttystatus.ElapsedTime())
- ts.add(ttystatus.Literal(' Looking for files: '))
- ts.add(ttystatus.Counter('pathname'))
- ts.add(ttystatus.Literal(' found, currently in '))
- ts.add(ttystatus.Pathname('dirname'))
+ ts.format('%ElapsedTime() Looking for files: %Counter(pathname) found, '
+ 'currently in %Pathname(dirname)')
pathnames = []
for dirname, subdirs, basenames in os.walk(sys.argv[1]):
diff --git a/example.py b/example.py
index 909ce46..5814fbc 100644
--- a/example.py
+++ b/example.py
@@ -25,11 +25,8 @@ import ttystatus
def main():
ts = ttystatus.TerminalStatus(period=0.1)
- ts.add(ttystatus.ElapsedTime())
- ts.add(ttystatus.Literal(' Looking for files: '))
- ts.add(ttystatus.Counter('pathname'))
- ts.add(ttystatus.Literal(' found, currently in '))
- ts.add(ttystatus.Pathname('dirname'))
+ ts.format('%ElapsedTime() Looking for files: %Counter(pathname) found, '
+ 'currently in %Pathname(dirname)')
pathnames = []
for dirname, subdirs, basenames in os.walk(sys.argv[1]):