-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
feat: add json formatted output option #768
Comments
Hey @alxpettit could you build this commit on your machine and tell me what you think of the output, and if it fits your need |
Looks like a good start! :) I'm seeing a couple of problems with the output, though:
I'll go over them in detail here. ColorThe color one seems pretty self explanatory. If we color the text, programs for parsing JSON may be confused by the character codes and introduce garbage into their own data. (EDIT: Although it just occurs to me now that it might change its behavior as it's being piped in, so this is probably fine.) Erroneously prints malformed JSON expressionsHere, let's use the directory structure of the project directory as an example. If I run it in this directory path like so:
This is super weird, because there's an extra FormattingTo make the structured data useful, the formatting should be in a table formation -- that's to say root-level list, with each entry being represented by key: value attribute relations. That way, programs know exactly what data they're trying to grab. I went ahead and formatted the project directory like so via Nushell ( |
didnt catch that with you understood color well gonna try and implement the key one tho. |
can you retry and tell me what do you think now, I made some updates |
Hey just a heads up to everyone here The recurse option is here 🎉 Can I have you all thought on it, and if you think --json --tree is needed |
It's become somewhat popular to include JSON output as an option, to make it easier to combine multiple utilities reliably. Examples include the
iproute
utilities (e.g.,ip --json addr
) andsystemd
utilities (e.g.,systemctl list-units -o json
). Structured data is a very powerful technique for organizing scripts -- so much so that shells are being created built around the concept (e.g., Nushell).The text was updated successfully, but these errors were encountered: