Skip to content

Commit

Permalink
docs: update examples
Browse files Browse the repository at this point in the history
Signed-off-by: Emilio Reyes <[email protected]>
  • Loading branch information
soda480 committed Dec 4, 2023
1 parent 99705a2 commit b18ad01
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,22 +152,27 @@ with ProgressBar(**kwargs) as pb:
Configure `ProgressBar` with a custom ticker, show duration, do not use color, and use regular expressions to determine the `total`, `count` and `alias` attributes:

```Python
import random
from faker import Faker
from progress1bar import ProgressBar

kwargs = {
'total': 575,
'clear_alias': True,
'show_complete': False,
'show_prefix': False,
'show_duration': True,
'show_bar': False
'ticker': 9733,
'regex': {
'total': r'^processing total of (?P<value>\d+)$',
'count': r'^processed .*$',
'alias': r'^processor is (?P<value>.*)$'
},
'use_color': False,
'show_duration': False
}
with ProgressBar(**kwargs) as pb:
for _ in range(pb.total):
pb.alias = Faker().sentence()
# simulate work
pb.count += 1
pb.match(f'processor is {Faker().name()}')
total = random.randint(500, 750)
pb.match(f'processing total of {total}')
for _ in range(total):
pb.match(f'processed {Faker().name()}')

```

![example](https://raw.githubusercontent.com/soda480/progress1bar/master/docs/images/example3.gif)
Expand Down
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
authors = [Author('Emilio Reyes', '[email protected]')]
summary = 'A customizable ANSI-based progress bar'
url = 'https://github.com/soda480/progress1bar'
version = '0.4.1'
version = '0.4.2'
default_task = [
'clean',
'analyze',
Expand Down

0 comments on commit b18ad01

Please sign in to comment.