Comments (4)
Sorry about that... looks like something went wrong there. I created a cli command for easy commandline usage similar to pv
but I totally forgot to finish it. I'll remove the command for now and re-add it once it's fully working.
from python-progressbar.
Facing the same issue, any update ?
from python-progressbar.
I'm working on a command that can be used as a drop-in replacement for the pv
(pipeview) command with better output and some extra intelligence. A sneak preview of what it should roughly handle (if possible):
import argparse
import contextlib
import pathlib
import sys
import time
import progressbar
def create_pv_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
description='Monitor the progress of data through a pipe.')
# Display switches
parser.add_argument('-p', '--progress', action='store_true',
help='Turn the progress bar on.')
parser.add_argument('-t', '--timer', action='store_true',
help='Turn the timer on.')
parser.add_argument('-e', '--eta', action='store_true',
help='Turn the ETA timer on.')
parser.add_argument('-I', '--fineta', action='store_true',
help='Display the ETA as local time of arrival.')
parser.add_argument('-r', '--rate', action='store_true',
help='Turn the rate counter on.')
parser.add_argument('-a', '--average-rate', action='store_true',
help='Turn the average rate counter on.')
parser.add_argument('-b', '--bytes', action='store_true',
help='Turn the total byte counter on.')
parser.add_argument('-8', '--bits', action='store_true',
help='Display total bits instead of bytes.')
parser.add_argument('-T', '--buffer-percent', action='store_true',
help='Turn on the transfer buffer percentage display.')
parser.add_argument('-A', '--last-written', type=int,
help='Show the last NUM bytes written.')
parser.add_argument('-F', '--format', type=str,
help='Use the format string FORMAT for output format.')
parser.add_argument('-n', '--numeric', action='store_true',
help='Numeric output.')
parser.add_argument('-q', '--quiet', action='store_true', help='No output.')
# Output modifiers
parser.add_argument('-W', '--wait', action='store_true',
help='Wait until the first byte has been transferred.')
parser.add_argument('-D', '--delay-start', type=float, help='Delay start.')
parser.add_argument('-s', '--size', type=str,
help='Assume total data size is SIZE.')
parser.add_argument('-l', '--line-mode', action='store_true',
help='Count lines instead of bytes.')
parser.add_argument('-0', '--null', action='store_true',
help='Count lines terminated with a zero byte.')
parser.add_argument('-i', '--interval', type=float,
help='Interval between updates.')
parser.add_argument('-m', '--average-rate-window', type=int,
help='Window for average rate calculation.')
parser.add_argument('-w', '--width', type=int,
help='Assume terminal is WIDTH characters wide.')
parser.add_argument('-H', '--height', type=int,
help='Assume terminal is HEIGHT rows high.')
parser.add_argument('-N', '--name', type=str,
help='Prefix output information with NAME.')
parser.add_argument('-f', '--force', action='store_true',
help='Force output.')
parser.add_argument('-c', '--cursor', action='store_true',
help='Use cursor positioning escape sequences.')
# Data transfer modifiers
parser.add_argument('-L', '--rate-limit', type=str,
help='Limit transfer to RATE bytes per second.')
parser.add_argument('-B', '--buffer-size', type=str,
help='Use transfer buffer size of BYTES.')
parser.add_argument('-C', '--no-splice', action='store_true',
help='Never use splice.')
parser.add_argument('-E', '--skip-errors', action='store_true',
help='Ignore read errors.')
parser.add_argument('-Z', '--error-skip-block', type=str,
help='Skip block size when ignoring errors.')
parser.add_argument('-S', '--stop-at-size', action='store_true',
help='Stop transferring after SIZE bytes.')
parser.add_argument('-Y', '--sync', action='store_true',
help='Synchronise buffer caches to disk after writes.')
parser.add_argument('-K', '--direct-io', action='store_true',
help='Set O_DIRECT flag on all inputs/outputs.')
parser.add_argument('-X', '--discard', action='store_true',
help='Discard input data instead of transferring it.')
parser.add_argument('-d', '--watchfd', type=str,
help='Watch file descriptor of process.')
parser.add_argument('-R', '--remote', type=int,
help='Remote control another running instance of pv.')
# General options
parser.add_argument('-P', '--pidfile', type=pathlib.Path,
help='Save process ID in FILE.')
parser.add_argument(
'input',
help='Input file path. Uses stdin if not specified.',
default='-',
nargs='*',
)
parser.add_argument(
'-o',
'--output',
default='-',
help='Output file path. Uses stdout if not specified.')
return parser
It won't be long, I promise :)
from python-progressbar.
I've created a new release with a progressbar
command that can be used as a drop-in replacement for pv
or to replace cat
as an automatic progressbar.
It can be used like this:
progressbar /dev/zero > /dev/zero
Or like this:
cat /dev/zero | progressbar > /dev/zero
If the filesize is available it will show a progressbar, if not, it will show a spinner like the regular progressbar would
from python-progressbar.
Related Issues (20)
- progressbar suddenly throwing 'function' object has no attribute 'ProgressBar' HOT 2
- Not sure how to go about doing this HOT 4
- outdatated progress bar? HOT 1
- Preventing regular ETA update or replacing it HOT 8
- ETA does not honor empty `format_finished` HOT 5
- Replace the moving average algorithm
- Not an issue but an idea HOT 4
- MultiBar does not work if any of the node has an empty string as key HOT 1
- Colored markers HOT 7
- 4.3.0: Windows OS: TypeError: '_fields_' must be a sequence of (name, C type) pairs HOT 3
- Progressbar update creates multiple lines HOT 19
- ProgressBar update no longer works with floats. HOT 3
- version 4.4: interactive shell: arrow keys yield weird symbols HOT 11
- Color support and ANSI terminal detection on Windows (broken for CMD.exe and Powershell.exe) HOT 5
- Missing separating blank line option HOT 4
- Progress bar out of range error HOT 1
- OSError exception from AbsoluteETA on Windows CPython HOT 1
- Syntax Error in latest release HOT 7
- broken import HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-progressbar.