Simplify string interpolation (#3401)

* [DRAFT] simplify string interpolation

* Fix test
This commit is contained in:
JT
2021-05-12 13:53:57 +12:00
committed by GitHub
parent 25a8caa9b0
commit 311c0e3f50
6 changed files with 62 additions and 117 deletions

View File

@ -8,7 +8,7 @@ fn reduce_table_column() {
echo "[{month:2,total:30}, {month:3,total:10}, {month:4,total:3}, {month:5,total:60}]"
| from json
| get total
| reduce -f 20 { $it + ( math eval `{{$acc}}^1.05` )}
| reduce -f 20 { $it + (math eval $"{$acc}^1.05")}
| str from -d 1
"#
)
@ -21,7 +21,7 @@ fn reduce_table_column() {
r#"
echo "[{month:2,total:30}, {month:3,total:10}, {month:4,total:3}, {month:5,total:60}]"
| from json
| reduce -f 20 { $it.total + ( math eval `{{$acc}}^1.05` )}
| reduce -f 20 { $it.total + (math eval $"{$acc}^1.05")}
| str from -d 1
"#
)