-
Notifications
You must be signed in to change notification settings - Fork 76
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
do not print to stdout when STREAM=0 #11
Conversation
Hi, thank you for your pull request. I think you misunderstood the purpose of function The role of STREAM and BRIEF can be better seen by running the following shell commands. But first, edit line 65 to insert for STREAM in 1 0; do for BRIEF in 0 1; do
echo BRIEF=$BRIEF STREAM=$STREAM
echo '[ {"a": 1} ]' | awk -f JSON.awk -v BRIEF=$BRIEF -v STREAM=$STREAM -
done; done
Now, what's with the last result |
All done in commit 4089faf. Please let me know if you have any concerns. Thank you. |
Thank you for explanations and documentation update. Indeed I misunderstood the purpose of function
Embedding JSON.awk with PS. I think you still have a different default STREAM value between the code (STREAM=1) and the FAQ (STREAM=0). |
Thank you for you comments. You're right about providing some mechanism to embed JSON.awk as is without needing to modify |
You're right,
|
Yes, maybe, in this order Just some thoughts now. A user is required to call awk with |
So, what about adding a test in your apply function ?
It would allow me to pass through the apply function and play with the JPATHS array in my custom script instead. |
I think it would need to call if(0 == STREAM) {
apply(JPATHS, NJPATHS)
} Since |
Yes, sure ! That's what I'm trying to do in this PR, calling apply only when (1 == STREAM). |
So you want for JSON.awk to output the JSON paths (STREAM=1) and to fill JPATHS so your redefined apply function can also process JPATHS?
I will not define an |
No, I want JSON.awk to not output the JSON when STREAM=0. |
That is what will happen.
With the enhancement that I described there will be no |
perfect for me :) |
Correct. I see no purpose in calling JSON.awk with STREAM=0 and no apply function because when STREAM=0 JSON.awk per se outputs nothing, and no function is processing jpaths. Anyway, I have pushed branch issue-12 which implements and documents the new interface. Function Please take a look and let me know what you think of it. Thank you. |
@aya did you see my comment? If you don't have time right now, that's OK, but let me know you've seen it, please. |
I tested your new branch. |
No description provided.