1
Fork 0

Improve error message for cfg arguments.

This provides the user with a helpful error message in case a key="value"
message was specified but couldn't be parsed.
This commit is contained in:
Ivor Wanders 2022-01-12 19:04:16 -05:00
parent 89b9f7b284
commit 90330b5330

View file

@ -124,7 +124,10 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> FxHashSet<(String, Option<String
Err(errs) => errs.into_iter().for_each(|mut err| err.cancel()), Err(errs) => errs.into_iter().for_each(|mut err| err.cancel()),
} }
error!(r#"expected `key` or `key="value"`"#); error!(concat!(
r#"expected `key` or `key="value"`, ensure escaping is appropriate"#,
r#" for your shell, try 'key="value"' or key=\"value\""#
));
}) })
.collect::<CrateConfig>(); .collect::<CrateConfig>();
cfg.into_iter().map(|(a, b)| (a.to_string(), b.map(|b| b.to_string()))).collect() cfg.into_iter().map(|(a, b)| (a.to_string(), b.map(|b| b.to_string()))).collect()