pad left instead of right, so units/thousands are aligned.

This commit is contained in:
KtorZ
2022-12-08 18:02:06 +01:00
committed by rvcas
parent 2ba712eef6
commit 4cae4a4467

View File

@@ -538,8 +538,8 @@ impl Project {
} else { } else {
"FAIL".bold().red().to_string() "FAIL".bold().red().to_string()
}, },
padding_right(mem.to_string(), max_mem, " "), pad_left(mem.to_string(), max_mem, " "),
padding_right(cpu.to_string(), max_cpu, " "), pad_left(cpu.to_string(), max_cpu, " "),
test.module.blue(), test.module.blue(),
test.name.bright_blue() test.name.bright_blue()
) )
@@ -707,13 +707,13 @@ fn is_aiken_path(path: &Path, dir: impl AsRef<Path>) -> bool {
) )
} }
fn padding_right(text: String, n: i32, delimiter: &str) -> String { fn pad_left(text: String, n: i32, delimiter: &str) -> String {
let mut text = text.clone(); let mut text = text.clone();
let diff = n - text.len() as i32; let diff = n - text.len() as i32;
if diff.is_positive() { if diff.is_positive() {
for _ in 0..diff { for _ in 0..diff {
text.push_str(delimiter); text.insert_str(0, delimiter);
} }
} }