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:
Gerry 2020-07-10 17:41:25 +02:00 committed by GitHub
parent bd68970fab
commit 427f48aa8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)