https://github.com/softprops/screenprints
reprints for your terminal screen
https://github.com/softprops/screenprints
Last synced: about 1 year ago
JSON representation
reprints for your terminal screen
- Host: GitHub
- URL: https://github.com/softprops/screenprints
- Owner: softprops
- License: mit
- Created: 2015-12-12T15:12:21.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-11T00:14:50.000Z (about 10 years ago)
- Last Synced: 2025-03-17T12:00:01.636Z (over 1 year ago)
- Language: Rust
- Homepage:
- Size: 531 KB
- Stars: 19
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# screenprints
[](https://travis-ci.org/softprops/screenprints) [](LICENSE) 
> reprints for your terminal screen
Screenprints acts as a buffer for terminal display continuously printing output at a configured interval.
## api docs
Find them [here](https://softprops.github.io/screenprints)
## usage
Screensprints defines a `Printer` which implements [std::io::Write](https://doc.rust-lang.org/std/io/trait.Write.html) which means anywhere you would normally write output to, you could substitude in an instance of a `Printer`.
```rust
extern crate screenprints;
use screenprints::Printer;
use std::io::{stdout, Write};
use std::time::Duration;
use std::thread;
fn main() {
let mut printer = Printer::new(stdout(), Duration::from_millis(10));
for f in &["foo.txt", "bar.txt", "baz.txt"] {
for i in 0..51 {
let _ = write!(printer, "Downloading {}.. ({}/{}) GB\n", f, i, 50);
thread::sleep(Duration::from_millis(50));
}
}
}
```
The result should look something like the following
[](https://asciinema.org/a/9auhm32umebr14bulaifhynni)
Doug Tangren (softprops) 2016