dasel icon indicating copy to clipboard operation
dasel copied to clipboard

--format from file

Open wino45 opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe. For a long format string it would be a convenient to load it from file, not only provided as a parameter.

Describe the solution you'd like Add a new parameter: --format-file <format-file>

Describe alternatives you've considered No alternatives were considered for this feature.

Additional context Templates can be quite complicated, especially when using range, if etc. I am trying to get information from a json to csv. The dasel cannot reference parent's node properties, so I needed to use range from template.

Even the simplest template is unreadable, when using --format : dasel select -f x.json -m '.[*]' --format '{{$id:=._id}}{{range $i:=.controlledBy}}{{printf "%s,%s\n" $id $i.zoneId}}{{end}}'

wino45 avatar Dec 07 '21 10:12 wino45

I've just seen this - I agree that this could be very useful. I'd be happy to support this in the future.

TomWright avatar Jan 04 '22 14:01 TomWright

Closing this as --format isn't supported in v2.

When I implement a relatable feature there I will include this functionality.

TomWright avatar Dec 06 '22 19:12 TomWright