-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Occasionally I reach for recs multiplex when I want to split a record stream into multiple files. For example, recs multiplex -k foo -- recs-tocsv works great, except all of the CSV output goes to stdout. When I'm using an output format without a distinct marker to split on, I usually work around this limitation using some combination of recs piped to parallel running the recs to... command. recs chain and recs generate seem like they would almost allow me to multiplex to separate files, but either generate needs to support outputting non-records or chain needs to support some sort of interpolation like generate (ick).
In terms of supporting this feature, I see two options:
- Build support into
multiplexitself. Something like--output-filename-key=<keyspec>or--output-filename=<snippet>on which output is written to for each group. The filename key or evaluated snippet would be added to the set of keys records are grouped upon. - Add a new operation which enables use of the existing
multiplexto do this, for example:recs multiplex -k foo -- recs-tofiles -k filename -- recs-tocsv
I think option one is cleaner than option two, both in terms of implementation and command line syntax. Option two however is implementable outside of core recs.
Is this feature worth having in core recs? General thoughts?