Commit 4ef14fb3 authored by Giorgos Verigakis's avatar Giorgos Verigakis
Browse files

Switch to progress for progress bars

parent 8db3fc19
......@@ -80,8 +80,8 @@ from pwd import getpwuid
from sys import argv, exit, stdout, stderr
from clint import args
from clint.textui import progress
from colors import magenta, red, yellow
from progress.bar import IncrementalBar
from requests.exceptions import ConnectionError
from kamaki import clients
......@@ -102,6 +102,10 @@ GROUPS = {
'astakos': "Astakos API commands"}
class ProgressBar(IncrementalBar):
suffix = '%(percent)d%% - %(eta)ds'
def command(api=None, group=None, name=None, syntax=None):
"""Class decorator that registers a class as a CLI command."""
......@@ -669,13 +673,10 @@ class _store_account_command(object):
"""Return a generator function to be used for progress tracking"""
MESSAGE_LENGTH = 25
MAX_PROGRESS_LENGTH = 32
def progress_gen(n):
msg = message.ljust(MESSAGE_LENGTH)
width = min(n, MAX_PROGRESS_LENGTH)
hide = self.config.get('global', 'silent') or (n < 2)
for i in progress.bar(range(n), msg, width, hide):
for i in ProgressBar(msg).iter(range(n)):
yield
yield
......
......@@ -52,6 +52,7 @@ setup(
},
install_requires=[
'ansicolors>=1.0',
'progress>=1.0',
'requests>=0.11',
'clint>=0.3',
]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment