-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathREADME
More file actions
93 lines (63 loc) · 2.32 KB
/
Copy pathREADME
File metadata and controls
93 lines (63 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Cli Progressbar
===============
It’s a lightweight and easy to use progress-bar for
command-line/terminal applications.
Install
-------
``pip install cli-progressbar``
Features
--------
- **Simple**, **Lightweight** and **Easy** to use.
- Single progressbar mode
- Custom Bar Characters
- **iterate** function to auto handle progressbar in ``for`` loops
Usage
-----
.. code:: python
from cli_progressbar import Progress
# define progressbar instance
progressbar = Progress(85)
# start function pass 0 to update function and print progressbar
# you can pass an string to show as status
progressbar.start('start status')
users = find_users() # return a list of users
# you can fill goal like this
progressbar.goal = len(users)
for i, user in enumerate(users):
# this function will update progressbar with new data and status
progressbar.update(i, 'processing status')
# Do your stuff
# stop function pass goal itself to update function
progressbar.stop('stop status')
But it’s boaring… so use ``iterate`` function:
.. code:: python
from cli_progressbar import Progress
progressbar = Progress()
progressbar.start('start status')
users = find_users()
for user in progressbar.iterate(users, 'processing status'):
# Do your stuff
progressbar.stop('stop status')
**iterate** function also support dynamic status, by passing a function
and each element of list as it input.
.. code:: python
for user in progressbar.iterate(users, lambda user: 'processing ' + user):
# Do your stuff
Parameters
----------
- ``goal`` to change goal in between of process, it’s useful for
dynamic tasks
- ``bar_len`` length of progressbar (default: 60)
- ``fill`` bar fill symbol (default: █)
- ``zfill`` bar zero fill symbol (default: -)
- ``decimals`` positive number of decimals in percent complete
(default: 1)
Any Questions? Report a Bug? Enhancements?
------------------------------------------
Please open a new issue on
`GitHub <https://github.com/mrunderline/cli-progressbar/issues>`__
License
-------
CLI-Progress is OpenSource and licensed under the terms of `The MIT
License (X11) <http://opensource.org/licenses/MIT>`__. You’re welcome to
`contribute <https://github.com/mrunderline/cli-progressbar/blob/master/CONTRIBUTE.md>`__!