Currently YS only supports YAML streams with a single document.
We can support multiple documents.
Each evaluated sequentially.
A load operation would produce the value of the final document.
From any document evaluation you can access data from a previously evaluated document in the stream with a special symbol.
Maybe ^ or $ or * or %.
Let's use ^ for now.
In the third document, ^1 points to the second (previous document) and ^2 points to the first and ^3 or higher returns nil.
^ is an alias for ^1.
The ys CLI will be changed to evaluate -e expressions after any file evaluation.
Then one can use ys like jq applying YS path syntax like so:
ys --load file.ys -e '^.foo.bar'
Another symbol ^^ points to a vector of all currently evaluated documents.
Thus ^^.0 is the first document and ^^.last() would be the current last one.
Currently YS only supports YAML streams with a single document.
We can support multiple documents. Each evaluated sequentially. A load operation would produce the value of the final document.
From any document evaluation you can access data from a previously evaluated document in the stream with a special symbol. Maybe
^
or$
or*
or%
. Let's use^
for now.In the third document,
^1
points to the second (previous document) and^2
points to the first and^3
or higher returnsnil
.^
is an alias for^1
.The ys CLI will be changed to evaluate
-e
expressions after any file evaluation. Then one can useys
likejq
applying YS path syntax like so:Another symbol
^^
points to a vector of all currently evaluated documents. Thus^^.0
is the first document and^^.last()
would be the current last one.