You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I often use dasel to mangle test data, and would like to be able to vary the values that I'm puting into the output.
Describe the solution you'd like
I'd like to be able to specify a node selector string in the value.
Where -V (or some other flag) tells dasel to run the query on the current node and use the result as the value. This example would set the attribute "Name": "Item <index>" for each Item object in the Items array.
Describe alternatives you've considered
If the set is large enough, I'd write a Ruby or awk script. My test sets tend to be small, so I usually just edit them by hand.
I also considered using --merge-input-documents, but I don't believe it'd replace the existing objects -- just add to them. In any case, it'd be fairly involved to create the merge document, and possibly more trouble than writing code to modify the data.
Being able to insert values relative to the document would, I think, be a more interesting generally, but for my use case it'd be sufficient if I could call a program (or shell function) for each node. I could generate values externally (if there was a mechanism for it), but (as I said) I imagine it might be more valuable in general to be able to, e.g., set a value from some permutation of another attribute in the node. E.g., set the Name attribute to the equivalent of template-ish "{{.FirstName}} {{.LastName}}"
To be clear, I like the direction you're thinking in. It's frankly better than what I was imagining.
Is your feature request related to a problem? Please describe.
I often use dasel to mangle test data, and would like to be able to vary the values that I'm
put
ing into the output.Describe the solution you'd like
I'd like to be able to specify a node selector string in the value.
Where
-V
(or some other flag) tells dasel to run the query on the current node and use the result as the value. This example would set the attribute"Name": "Item <index>"
for eachItem
object in theItems
array.Describe alternatives you've considered
If the set is large enough, I'd write a Ruby or awk script. My test sets tend to be small, so I usually just edit them by hand.
I also considered using
--merge-input-documents
, but I don't believe it'd replace the existing objects -- just add to them. In any case, it'd be fairly involved to create the merge document, and possibly more trouble than writing code to modify the data.Additional context
I'd like to turn this:
into this:
The text was updated successfully, but these errors were encountered: