1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-28 07:46:28 +00:00

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

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):");
// 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 {
println!(
" {}{} - {}{} - {}",
" {}{} - {}{} - \"{}\"",
timing.name,
" ".repeat(max_name_width - (timing.name_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);
// In addition to the module width itself there are also 9 padding characters in each line.
// Overall a line looks like this: " {module value} ({xxxms}) - {description}".
const PADDING_WIDTH: usize = 9;
// 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}".
const PADDING_WIDTH: usize = 11;
let desc_width = term_size::dimensions()
.map(|(w, _)| w)
@ -238,7 +238,7 @@ pub fn explain(args: ArgMatches) {
let mut escaping = false;
// Print info
print!(
" {} ({}){} - ",
" \"{}\" ({}){} - ",
info.value,
info.duration,
" ".repeat(max_module_width - (info.value_len))