failures now report time too
This commit is contained in:
parent
6b3d12e7f9
commit
0fbf3f2522
1 changed files with 10 additions and 9 deletions
|
@ -64,13 +64,14 @@ pub fn apply(targets: &Vec<Map<String, Value>>) {
|
||||||
|
|
||||||
// copy and print
|
// copy and print
|
||||||
let result = fs::copy(source, destination);
|
let result = fs::copy(source, destination);
|
||||||
|
let time = time(start);
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
println!(" {BOLD}{FAILURE}failed to copy{RESET}");
|
print!(" {BOLD}{FAILURE}failed to copy{RESET}");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let time = time(start);
|
print!(" {BOLD}{SUCCESS}completed{RESET}");
|
||||||
println!(" {BOLD}{SUCCESS}completed{RESET} {FAINT}({time}){RESET}");
|
|
||||||
}
|
}
|
||||||
|
println!(" {FAINT}({time}){RESET}");
|
||||||
}
|
}
|
||||||
let time = time(start);
|
let time = time(start);
|
||||||
println!("{FAINT}(apply: {time}){RESET}");
|
println!("{FAINT}(apply: {time}){RESET}");
|
||||||
|
@ -109,23 +110,23 @@ pub fn build(targets: &Vec<Map<String, Value>>, template_dir: String, config: &C
|
||||||
|
|
||||||
let content = read_to_string(path).unwrap();
|
let content = read_to_string(path).unwrap();
|
||||||
let template = engine.compile(&content);
|
let template = engine.compile(&content);
|
||||||
|
let compile_time = time(compile_start);
|
||||||
|
print!(" {FAINT}({compile_time}){RESET}");
|
||||||
if let Err(error) = template {
|
if let Err(error) = template {
|
||||||
println!("\n {BOLD}{FAILURE}failed to compile template:{RESET}\n {FAILURE}{error}\n {BOLD}skipping{RESET}");
|
println!("\n {BOLD}{FAILURE}failed to compile template:{RESET}\n {FAILURE}{error}\n {BOLD}skipping{RESET}");
|
||||||
continue;
|
continue;
|
||||||
}
|
} else { println!(); }
|
||||||
let compile_time = time(compile_start);
|
|
||||||
println!(" {FAINT}({compile_time}){RESET}");
|
|
||||||
|
|
||||||
// render
|
// render
|
||||||
let render_start = SystemTime::now();
|
let render_start = SystemTime::now();
|
||||||
print!(" {ITALIC}rendering{RESET}");
|
print!(" {ITALIC}rendering{RESET}");
|
||||||
let render = template.unwrap().render(&engine, &context).to_string();
|
let render = template.unwrap().render(&engine, &context).to_string();
|
||||||
|
let render_time = time(render_start);
|
||||||
|
print!(" {FAINT}({render_time}){RESET}");
|
||||||
if let Err(error) = render {
|
if let Err(error) = render {
|
||||||
println!("\n {BOLD}{FAILURE}failed to render template:{RESET}\n {FAILURE}{error}\n {BOLD}skipping{RESET}");
|
println!("\n {BOLD}{FAILURE}failed to render template:{RESET}\n {FAILURE}{error}\n {BOLD}skipping{RESET}");
|
||||||
continue;
|
continue;
|
||||||
}
|
} else { println!(); }
|
||||||
let render_time = time(render_start);
|
|
||||||
println!(" {FAINT}({render_time}){RESET}");
|
|
||||||
|
|
||||||
// get rendered text and open destination file
|
// get rendered text and open destination file
|
||||||
let output = render.unwrap();
|
let output = render.unwrap();
|
||||||
|
|
Loading…
Reference in a new issue