Paths can be displayed as strings.

This commit is contained in:
Andrés N. Robalino 2019-09-10 05:28:15 -05:00
parent f61144006f
commit 11ef007491
2 changed files with 2 additions and 1 deletions

View File

@ -127,7 +127,7 @@ pub fn config(
let path = config::default_path_for(&configuration)?;
return Ok(stream![Tagged::from_simple_spanned_item(
Value::string(path.to_string_lossy()),
Value::Primitive(Primitive::Path(path)),
span
)]
.from_input_stream());

View File

@ -558,6 +558,7 @@ impl Value {
Value::Primitive(Primitive::Decimal(x)) => Ok(format!("{}", x)),
Value::Primitive(Primitive::Int(x)) => Ok(format!("{}", x)),
Value::Primitive(Primitive::Bytes(x)) => Ok(format!("{}", x)),
Value::Primitive(Primitive::Path(x)) => Ok(format!("{}", x.display())),
// TODO: this should definitely be more general with better errors
other => Err(ShellError::string(format!(
"Expected string, got {:?}",