Skip to content

Commit 6107a93

Browse files
committed
Add progress bar
1 parent 1bec8aa commit 6107a93

5 files changed

Lines changed: 223 additions & 10 deletions

File tree

Cargo.lock

Lines changed: 207 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ clap = "2.33.0"
99
glob = "0.3.0"
1010
rand = "0.6.5"
1111
rayon = "1.1.0"
12+
indicatif = "0.11.0"
1213

1314
[lib]
1415
name = "icfpc"

src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use clap::{App, Arg};
22
use rayon::prelude::*;
33
use std::fs::File;
44
use std::io::Write;
5+
use indicatif::ProgressBar;
56

67
use icfpc::models::*;
78
use icfpc::parse::read_all_inputs;
@@ -36,8 +37,8 @@ fn main() {
3637
let output_root = matches.value_of("output");
3738

3839
let inputs = read_all_inputs(&input_root);
40+
let progress_bar = ProgressBar::new(inputs.len() as u64);
3941
inputs.into_par_iter().for_each(|input| {
40-
eprintln!("{}", input.output_file_name());
4142
let mut output_file: Box<Write> = match output_root {
4243
Some(output_root) => {
4344
let output_path = format!("{}/{}", output_root, input.output_file_name());
@@ -47,5 +48,7 @@ fn main() {
4748
None => Box::new(std::io::stdout()),
4849
};
4950
solve(input.task, &mut output_file);
51+
progress_bar.inc(1);
5052
});
53+
progress_bar.finish();
5154
}

0 commit comments

Comments
 (0)