mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-19 11:35:16 +00:00
fix(nodejs): remove line break from version (#1464)
A recent refactor of modules to use format strings accidentally got rid of the `trim()` on the NodeJS version string. This just adds it back so that the prompt doesn't include an unnecessary line break when showing that module.
This commit is contained in:
parent
bd68970fab
commit
427f48aa8d
@ -30,6 +30,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
|||||||
|
|
||||||
let mut module = context.new_module("nodejs");
|
let mut module = context.new_module("nodejs");
|
||||||
let config = NodejsConfig::try_load(module.config);
|
let config = NodejsConfig::try_load(module.config);
|
||||||
|
let nodejs_version = utils::exec_cmd("node", &["--version"])?.stdout;
|
||||||
let parsed = StringFormatter::new(config.format).and_then(|formatter| {
|
let parsed = StringFormatter::new(config.format).and_then(|formatter| {
|
||||||
formatter
|
formatter
|
||||||
.map_meta(|var, _| match var {
|
.map_meta(|var, _| match var {
|
||||||
@ -41,7 +42,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
|||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.map(|variable| match variable {
|
.map(|variable| match variable {
|
||||||
"version" => Some(Ok(utils::exec_cmd("node", &["--version"])?.stdout)),
|
"version" => Some(Ok(nodejs_version.trim())),
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.parse(None)
|
.parse(None)
|
||||||
|
Loading…
Reference in New Issue
Block a user