Make grouping more flexible. (#1741)

This commit is contained in:
Andrés N. Robalino
2020-05-09 12:15:47 -05:00
committed by GitHub
parent 9a94b3c656
commit f93ff9ec33
5 changed files with 132 additions and 55 deletions

View File

@ -272,6 +272,13 @@ impl Value {
}
}
pub fn format(&self, fmt: &str) -> Result<String, ShellError> {
match &self.value {
UntaggedValue::Primitive(Primitive::Date(dt)) => Ok(dt.format(fmt).to_string()),
_ => Err(ShellError::type_error("date", self.spanned_type_name())),
}
}
/// View into the borrowed string contents of a Value, if possible
pub fn as_forgiving_string(&self) -> Result<&str, ShellError> {
match &self.value {