Open mikedowler opened 4 years ago
That's not a use case I had in mind to add a value, as Scout was primarily designed to change one single value at a time. Here, it's a group value that you want to change. So it's not possible to do it for now, sadly. But that's a really interesting feature and this can be bundled in a future release. I am marking this issue as an enhancement.
I'd like to be able to add an new entry which duplicates all the properties of an existing entry. For example, using
people.json
, I'd like to createTom
's evil twin,evilTom
.I can't pass a reference to an existing entry:
scout add -i /tmp/people.json "people.evilTom=people.Tom"
merely adds the string "people.Tom" toevilTom
.Capturing the output of
Tom
to a variable first:tom=$(scout read -i /tmp/people.json "people.Tom")
is fine, but then adding it to a new entryscout add -i /tmp/people.json "people.evilTom=$tom"
simply adds it as a text string, meaning it can no longer be parsed.It seems like the only option is to read each individual property (which requires knowledge of the datatype of that property) and then write that individual property to the new location. I feel like this is a task which ought to be much easier in Scout, but would actually be easier with a text parser. Am I missing something?