feat(explain): quote module values (#2931)

This commit is contained in:
David Knaack 2021-07-30 04:45:03 +02:00 committed by GitHub
parent af43aeefba
commit 66159cd940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -177,10 +177,10 @@ pub fn timings(args: ArgMatches) {
println!("\n Here are the timings of modules in your prompt (>=1ms or output):"); println!("\n Here are the timings of modules in your prompt (>=1ms or output):");
// for now we do not expect a wrap around at the end... famous last words // for now we do not expect a wrap around at the end... famous last words
// Overall a line looks like this: " {module name} - {duration} - {module value}". // Overall a line looks like this: " {module name} - {duration} - "{module value}"".
for timing in &modules { for timing in &modules {
println!( println!(
" {}{} - {}{} - {}", " {}{} - {}{} - \"{}\"",
timing.name, timing.name,
" ".repeat(max_name_width - (timing.name_len)), " ".repeat(max_name_width - (timing.name_len)),
" ".repeat(max_duration_width - (timing.duration_len)), " ".repeat(max_duration_width - (timing.duration_len)),
@ -221,9 +221,9 @@ pub fn explain(args: ArgMatches) {
let max_module_width = modules.iter().map(|i| i.value_len).max().unwrap_or(0); let max_module_width = modules.iter().map(|i| i.value_len).max().unwrap_or(0);
// In addition to the module width itself there are also 9 padding characters in each line. // In addition to the module width itself there are also 11 padding characters in each line.
// Overall a line looks like this: " {module value} ({xxxms}) - {description}". // Overall a line looks like this: " "{module value}" ({xxxms}) - {description}".
const PADDING_WIDTH: usize = 9; const PADDING_WIDTH: usize = 11;
let desc_width = term_size::dimensions() let desc_width = term_size::dimensions()
.map(|(w, _)| w) .map(|(w, _)| w)
@ -238,7 +238,7 @@ pub fn explain(args: ArgMatches) {
let mut escaping = false; let mut escaping = false;
// Print info // Print info
print!( print!(
" {} ({}){} - ", " \"{}\" ({}){} - ",
info.value, info.value,
info.duration, info.duration,
" ".repeat(max_module_width - (info.value_len)) " ".repeat(max_module_width - (info.value_len))