#progress-bar #displaying #bars #compact

progrs

A small library for displaying compact progress bars

2 releases

Uses old Rust 2015

0.1.1 Sep 3, 2017
0.1.0 Jun 29, 2017

#8 in #bars


Used in pijul

GPL-2.0+

5KB
59 lines

A Git-like progress bar for Rust CLI programs

A small library for displaying progress bars a la Git in terminal programs.

In the author's opinion, the output from Git operations like clone and pull is not too little and not too much - it's juuust right. In particular, showing progress is desirable for potentially long-running network operations.

TODO

  • Add throughput to progress

Example

remote: Counting objects: 218676, done.
remote: Compressing objects: 100% (58659/58659), done.
remote: Total 218676 (delta 162851), reused 213808 (delta 158032)
Receiving objects: 100% (218676/218676), done.
Resolving deltas: 100% (162851/162851), done.

lib.rs:

progrs: A small library for displaying progress in terminal programs

There are a number of libraries out there that can be used for progress display, but in the author's opinion these libraries do it almost right - either they eat up too much screen real estate (by not sticking to one line per thing that should use progress) or they try to align stuff left and right.

In the author's humble opinion, the best example of just the right amount of information vs screen real-estate is in the Git progress output (when cloning, pulling, etc). It uses one line per thing, and may display both percentage complete (in cases where it's known) and even throughput (for network transfer).

This library mimics the Git way of showing progress.

Example

let (mut n, nobjects) = (0, 218676);
let mut p = progrs::start("Collecting objects", Some(nobjects));
while n < nobjects {
    n += collect_more_objects();
    p.display(n);
}
p.stop("done");

which will produce the output:

Collecting objects: 100% (218676/218676), done.

TODO

  • Add throughput display to Progress

No runtime deps