Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luciancooper/cmdprogress
Python Command Line Progress Bars
https://github.com/luciancooper/cmdprogress
Last synced: 2 days ago
JSON representation
Python Command Line Progress Bars
- Host: GitHub
- URL: https://github.com/luciancooper/cmdprogress
- Owner: luciancooper
- License: mit
- Created: 2018-12-06T12:45:06.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-07T19:29:13.000Z (about 6 years ago)
- Last Synced: 2024-08-09T16:52:21.822Z (6 months ago)
- Language: Python
- Size: 739 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cmdprogress
[![PyPI version shields.io](https://img.shields.io/pypi/v/cmdprogress.svg)](https://pypi.python.org/pypi/cmdprogress/)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/cmdprogress.svg)](https://pypi.python.org/pypi/cmdprogress/)
[![PyPI license](https://img.shields.io/pypi/l/cmdprogress.svg)](https://pypi.python.org/pypi/cmdprogress/)Cross Platform Python Command Line Progress Bars
**MacOS**
![Multi Bar](https://raw.githubusercontent.com/luciancooper/cmdprogress/master/multi_mac.gif)
**Windows**
![Multi Bar](https://raw.githubusercontent.com/luciancooper/cmdprogress/master/multi_win.gif)
**Linux**
### Contents
* [Installation](#installation)
* [ProgBar](#ProgBar)
* [MultiBar](#MultiBar)
* [Acknowledgements](#Acknowledgements)# Installation
Use `pip` via [PyPi](https://pypi.org)
```bash
pip install cmdprogress
```**Or** use `git`
```bash
git clone git://github.com/luciancooper/cmdprogress.git cmdprogress
cd cmdprogress
python setup.py install
```## Usage
this project consists of two instantiatable classes: `ProgBar` and `MultiBar`
# ProgBar
There are two ways to use a `ProgBar`
Either give it a length when you instantiate the object, and then directly loop through it
```python
from cmdprogress.bar import ProgBarbar = ProgBar(max=5)
for x in bar:
# x = (0 .. 5)
# do some work
```Or do not provide it a length when you instantiate it, instead provide it an iterable to wrap
```python
from cmdprogress.bar import ProgBarbar = ProgBar()
for x in bar.iter(range(5)):
# x = (0 .. 5)
# do some work
```# MultiBar
There are 3 ways to use a `MultiBar`.
```python
from cmdprogress.multi import MultiBarbar = MultiBar(lvl=2)
for i in bar.iter(range(5)):
for j in bar.iter(range(10)):
# do some work```
```python
from cmdprogress.multi import MultiBarbar = MultiBar(5,lvl=2)
for x in range(5):
for i in bar.iter(range(10)):
# do some work```
```python
from cmdprogress.multi import MultiBarbar = MultiBar(5,10)
for x in bar:
# x will be the tuple (i,j)
# do some work```
## Acknowledgements
- This project depends on [colorama](https://pypi.org/project/colorama/) to work in the Windows Command Line
- Shoutout to this [stack overflow answer](https://stackoverflow.com/a/10455937)