Skip to content

Commit b18ad01

Browse files
committed
docs: update examples
Signed-off-by: Emilio Reyes <soda480@gmail.com>
1 parent 99705a2 commit b18ad01

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,22 +152,27 @@ with ProgressBar(**kwargs) as pb:
152152
Configure `ProgressBar` with a custom ticker, show duration, do not use color, and use regular expressions to determine the `total`, `count` and `alias` attributes:
153153

154154
```Python
155+
import random
155156
from faker import Faker
156157
from progress1bar import ProgressBar
157158

158159
kwargs = {
159-
'total': 575,
160-
'clear_alias': True,
161-
'show_complete': False,
162-
'show_prefix': False,
163-
'show_duration': True,
164-
'show_bar': False
160+
'ticker': 9733,
161+
'regex': {
162+
'total': r'^processing total of (?P<value>\d+)$',
163+
'count': r'^processed .*$',
164+
'alias': r'^processor is (?P<value>.*)$'
165+
},
166+
'use_color': False,
167+
'show_duration': False
165168
}
166169
with ProgressBar(**kwargs) as pb:
167-
for _ in range(pb.total):
168-
pb.alias = Faker().sentence()
169-
# simulate work
170-
pb.count += 1
170+
pb.match(f'processor is {Faker().name()}')
171+
total = random.randint(500, 750)
172+
pb.match(f'processing total of {total}')
173+
for _ in range(total):
174+
pb.match(f'processed {Faker().name()}')
175+
171176
```
172177

173178
![example](https://raw.githubusercontent.com/soda480/progress1bar/master/docs/images/example3.gif)

build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
authors = [Author('Emilio Reyes', 'soda480@gmail.com')]
1616
summary = 'A customizable ANSI-based progress bar'
1717
url = 'https://github.com/soda480/progress1bar'
18-
version = '0.4.1'
18+
version = '0.4.2'
1919
default_task = [
2020
'clean',
2121
'analyze',

0 commit comments

Comments
 (0)