-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple files or urls as input #28
Comments
Hi @jspashett! Thanks for submitting an issue :) I think it would make sense to use the same behaviour as the stream mode in this case; i.e. treating each file as an item in an array like this:
I think what might be tricky here is figuring out what happens when the stream mode is used by multiple files. I'll give that some thought and get back to you if that's OK? :) |
Here are some suggestions. "Stream" might be the wrong word, perhaps they should be called documents? say file1 has 3 separate json objects within it.
(a)
(b) Just number them as you would anyway.
(c) Like a or b but add a comment line saying what the source was. e.g.:
In (a) you can tell which file and which object something comes from. in (b), you can't but it is simpler. |
@jspashett Ah, I wasn't very clear about what I meant there sorry! I think your option Thanks! |
another example for this improvement: |
Throwing my thoughts/desire behind this enhancement. I just ran into a case where this would be very helpful. In my case, I had multiple files all of the same general structure, so I basically wanted this:
to act like this:
( producing:
I think in the case of multiple files being displayed, the Alternately, require
I would think the keys here would be either the filename or the provided path. But have a flag to switch behavior. |
IMHO, |
This relates to multiple objects in the same input, but is a bit different.
Would be useful to allow more than one input on the command line:
gron <file|url> <file|url> ... etc
It's hard to say exactly what gron should output in this case, possibly each object field could inherit the file or url name.
e.g.
gron file1.json file2.json
file1.keyValue = "fish"
file2.keyValue = "chips"
or perhaps more simply, number the files, which would avoid file name clashes (and could also support multiple objects in streams.)
[0].keyValue = "fish"
[1].keyValue = "chips"
at the moment, I for this, which isn't quite as good:
echo *.json | xargs -n1 gron >> out.txt
The text was updated successfully, but these errors were encountered: