summaryrefslogtreecommitdiff
path: root/shellutils.py
diff options
context:
space:
mode:
authorPierre-Yves David <pierre-yves.david@logilab.fr>2008-06-26 17:43:36 +0200
committerPierre-Yves David <pierre-yves.david@logilab.fr>2008-06-26 17:43:36 +0200
commit8cd622fe855c93c16f01a31d95418ba7ba539377 (patch)
treeef30147b2ec7d4c7a469c35b8adb079a299806b8 /shellutils.py
parent09256f8fbf9845b6f0534166b95bace4a2a665ae (diff)
downloadlogilab-common-8cd622fe855c93c16f01a31d95418ba7ba539377.tar.gz
fix a bug in shellutils.ProgressBar
Diffstat (limited to 'shellutils.py')
-rw-r--r--shellutils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/shellutils.py b/shellutils.py
index dd9207f..70f5c4b 100644
--- a/shellutils.py
+++ b/shellutils.py
@@ -193,7 +193,7 @@ class ProgressBar(object):
def __init__(self, nbops, size=20., stream=sys.stdout):
self._dotevery = max(nbops / size, 1)
- self._fstr = '\r[%-20s]'
+ self._fstr = '\r[%%-%ss]' % size
self._dotcount, self._dots = 1, []
self._stream = stream
@@ -201,7 +201,7 @@ class ProgressBar(object):
"""update the progression bar"""
self._dotcount += 1
if self._dotcount >= self._dotevery:
- self._dotcount = 1
+ self._dotcount = 0
self._dots.append('.')
self._stream.write(self._fstr % ''.join(self._dots))
self._stream.flush()