1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

Merge pull request #4221 from ctsk/cp-init-progress-bar

Tick after creating progress bar to draw it
This commit is contained in:
Terts Diepraam 2022-12-07 19:56:57 +01:00 committed by GitHub
commit ae044d4800
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -971,16 +971,16 @@ fn copy(sources: &[Source], target: &TargetSlice, options: &Options) -> CopyResu
let mut symlinked_files = HashSet::new(); let mut symlinked_files = HashSet::new();
let progress_bar = if options.progress_bar { let progress_bar = if options.progress_bar {
Some( let pb = ProgressBar::new(disk_usage(sources, options.recursive)?)
ProgressBar::new(disk_usage(sources, options.recursive)?)
.with_style( .with_style(
ProgressStyle::with_template( ProgressStyle::with_template(
"{msg}: [{elapsed_precise}] {wide_bar} {bytes:>7}/{total_bytes:7}", "{msg}: [{elapsed_precise}] {wide_bar} {bytes:>7}/{total_bytes:7}",
) )
.unwrap(), .unwrap(),
) )
.with_message(uucore::util_name()), .with_message(uucore::util_name());
) pb.tick();
Some(pb)
} else { } else {
None None
}; };