Git Product home page Git Product logo

progressbar's Introduction

GH stars GH tag Shellcheck CI bash_unit CI GH Language GH License basher install

pforret/progressbar

test

Show a CLI progress bar for long-running programs, like rsync, ffmpeg, tar, zip, wget, ... or your own script

Add a progressbar to anything

Installation

with basher

$ basher install pforret/progressbar

or with git

$ git clone https://github.com/pforret/progressbar.git
$ cd progressbar
$ sudo ln -s $(pwd)/progressbar /usr/local/bin/ # or someone else in your path

Usage

Program: progressbar 1.1.0 by [email protected]
Updated: Dec  1 14:39:22 2020
Usage: progressbar [-h] [-q] [-v] [-f] [-l <log_dir>] [-t <tmp_dir>] [-b <bar>] [-c <char>] <action> <input>
Flags, options and parameters:
    -h|--help      : [flag] show usage [default: off]
    -q|--quiet     : [flag] no output [default: off]
    -v|--verbose   : [flag] output more [default: off]
    -f|--force     : [flag] do not ask for confirmation (always yes) [default: off]
    -l|--log_dir <val>: [optn] folder for log files   [default: log]
    -t|--tmp_dir <val>: [optn] folder for temp files  [default: /tmp/progressbar]
    -b|--bar <val>: [optn] format of bar: normal/half/long/short  [default: normal]
    -c|--char <val>: [optn] character to use a filler  [default: #]
    <action>  : [parameter] lines/seconds/clear/check
    <input>   : [parameter] input number or operation identifier     

Examples

Demo

Simple use: # lines or seconds is known

# when the approx number of lines output is known
# e.g. first do a rsync --dry-run to check how many files have to be trasferred
# and then use this number in the actual operation
$ expected_lines=$(rsync --dry-run <from> <to> | awk 'END {print NR}')
$ rsync <from> <to> | progressbar lines "$expected_lines"

# similarly: when the approx number of seconds is known
$ <do_something_for_1_hour> | progressbar seconds 3600

Auto-estimate lines/seconds

# the first time the script learns the expected # lines/seconds for operation '40-pings-to-google'
$ ping -c 40 www.google.com | progressbar lines 40-pings-to-google
45 lines / 39 secs …

# the following times, it can use this information to show a 0-100% progressbar
$ ping -c 40 www.google.com | progressbar lines 40-pings-to-google
[############################--3---------4---------5---------6---------7---------8---------9--------] 28% / 11 secs … 

# can also be used with different progress bar format (here: short)
$ ping -c 40 www.google.com | progressbar -b short lines 40-pings-to-google
[##-------] 28% / 11 secs … 

# use '|' as character for 'done' time
$ ping -c 40 www.google.com | progressbar -c '|' lines 40-pings-to-google
[|||||||||||||||||||||||||||||||||||-----4---------5---------6---------7---------8---------9--------] 35% / 14 secs … 


# for instance, to use it with rsync, first do a --dry-run (rather fast) to get the estimated # of lines
$ rsync --dry-run -avz source/ destination/ | progressbar lines long-rsync-operation

# and then run the actual operation, which will take much longer, but will output +- the same # of lines
$ rsync -avz source/ destination/ | progressbar lines long-rsync-operation

Acknowledgements

© 2020 Peter Forret

progressbar's People

Contributors

pforret avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.