Extracted grouping by date to it's own subcommand. (#1792)

This commit is contained in:
Andrés N. Robalino
2020-05-15 04:16:09 -05:00
committed by GitHub
parent 5fbe5cf785
commit fc8ee8e4b9
6 changed files with 129 additions and 62 deletions

View File

@ -392,6 +392,7 @@ pub fn as_path_member(value: &Value) -> Result<PathMember, ShellError> {
pub fn as_string(value: &Value) -> Result<String, ShellError> {
match &value.value {
UntaggedValue::Primitive(Primitive::String(s)) => Ok(s.clone()),
UntaggedValue::Primitive(Primitive::Date(dt)) => Ok(dt.format("%Y-%b-%d").to_string()),
UntaggedValue::Primitive(Primitive::Boolean(x)) => Ok(format!("{}", x)),
UntaggedValue::Primitive(Primitive::Decimal(x)) => Ok(format!("{}", x)),
UntaggedValue::Primitive(Primitive::Int(x)) => Ok(format!("{}", x)),