-
-
Notifications
You must be signed in to change notification settings - Fork 98
Add colors to JSON printer #3343
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
Conversation
30a809c
to
6eb99d9
Compare
I'm not sure I like these new defaults. I guess I don't have a strong opinion. Can you please add support for |
These are
I added support for |
Something that I can add to my |
This is out of scope for this PR. We don't have something like that yet. I also don't think operators should be able to configured in an external file. Then you can no longer share pipelines and assume they do what you'd expect. |
Not really, but since every operator is a plugin, you could use the plugin configuration for that.
We have the same problem with environment variables like |
I guess not providing config options for operators is fine for most cases, purely cosmetic options like |
We're trying to mimic `jq` as close as possible. This means that `write json` should print tree-style JSON and not NDJSON. The new -c or --compact-output optiosn switches to NDJSON instead.
a97747f
to
46e3c66
Compare
vast/integration/reference/zeek-tsv-pipeline-format/step_10.ref
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working well in practice. Thanks!
@dominiklohmann I saw you sneaking in the |
Hah, I just noticed that being documented but not implemented when reviewing this PR, so I asked Daniel whether it was okay to just push it on top. Felt quicker than writing a story for it. |
I will be happy indeed :) Thanks! BTW, are you using |
We discussed somewhere in a thread for this PR that we actually need to pass that information up from the last operator, and wrote a follow-up story for that. For now, colors are opt-in. E.g., if you run this:
Then the information of whether or not we're printing to a terminal must be passed from |
I see, true! |
7a7402c
to
9476d91
Compare
This PR brings a few JSON printer changes:
--pretty
the default forwrite json
--pretty
in favor of the opposite-c|--compact-output
(likejq
)-C|--color-output
and-M|--monochrome-output
to explicitly set the color.Unlike
jq
, there's currently no auto-detection of colors. You have to provide-C
for now. While we could do TTY detection, it's a bit more complicated from the printer's perspective, because we need to know the corresponding saver in order to make a call. If it's stdout, we can add colors, if it's a file, we can't.