fix: Fix incorrect prefix usage in cmd_duration module (#832)
Fixed the way the cmd_duration module is setting it's prefix to be the same as the other modules.
This commit is contained in:
parent
8f645ffb8a
commit
197376633a
|
@ -36,13 +36,11 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
||||||
};
|
};
|
||||||
|
|
||||||
module.set_style(module_color);
|
module.set_style(module_color);
|
||||||
let cmd_duration_stacked = &format!(
|
module.create_segment(
|
||||||
"{}{}",
|
"cmd_duration",
|
||||||
config.prefix,
|
&SegmentConfig::new(&render_time(elapsed, config.show_milliseconds)),
|
||||||
render_time(elapsed, config.show_milliseconds)
|
|
||||||
);
|
);
|
||||||
module.create_segment("cmd_duration", &SegmentConfig::new(&cmd_duration_stacked));
|
module.get_prefix().set_value(config.prefix);
|
||||||
module.get_prefix().set_value("");
|
|
||||||
|
|
||||||
Some(module)
|
Some(module)
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ fn config_blank_duration_5s() -> io::Result<()> {
|
||||||
.output()?;
|
.output()?;
|
||||||
let actual = String::from_utf8(output.stdout).unwrap();
|
let actual = String::from_utf8(output.stdout).unwrap();
|
||||||
|
|
||||||
let expected = format!("{} ", Color::Yellow.bold().paint("took 5s"));
|
let expected = format!("took {} ", Color::Yellow.bold().paint("5s"));
|
||||||
assert_eq!(expected, actual);
|
assert_eq!(expected, actual);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ fn config_5s_duration_10s() -> io::Result<()> {
|
||||||
.output()?;
|
.output()?;
|
||||||
let actual = String::from_utf8(output.stdout).unwrap();
|
let actual = String::from_utf8(output.stdout).unwrap();
|
||||||
|
|
||||||
let expected = format!("{} ", Color::Yellow.bold().paint("took 10s"));
|
let expected = format!("took {} ", Color::Yellow.bold().paint("10s"));
|
||||||
assert_eq!(expected, actual);
|
assert_eq!(expected, actual);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ fn config_5s_duration_prefix_underwent() -> io::Result<()> {
|
||||||
.output()?;
|
.output()?;
|
||||||
let actual = String::from_utf8(output.stdout).unwrap();
|
let actual = String::from_utf8(output.stdout).unwrap();
|
||||||
|
|
||||||
let expected = format!("{} ", Color::Yellow.bold().paint("underwent 5s"));
|
let expected = format!("underwent {} ", Color::Yellow.bold().paint("5s"));
|
||||||
assert_eq!(expected, actual);
|
assert_eq!(expected, actual);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue