Skip to content
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

Human-readable cargo output with json errors #11018

Closed
typecasto opened this issue Aug 24, 2022 · 1 comment
Closed

Human-readable cargo output with json errors #11018

typecasto opened this issue Aug 24, 2022 · 1 comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@typecasto
Copy link

Problem

I'm trying to write a cargo wrapper that formats the errors using the ariadne crate. Using --message-format json allows me to parse the compiler messages and format them, but it also changes the rest of the output (downloading crates, progress bars, etc) into json as well, meaning I either have to parse the human-readable errors instead.

Proposed Solution

Either of the following would work, I have no strong feelings one way or the other, but I suspect the latter might be useful to more people:

  • Add a message-format that outputs rustc messages (errors, warnings, etc) in json format, but outputs everything else (downloading/building crates, updating crate index, progress bars, etc.) in the normal, human-readable format.
  • Add --error-format json | human | short to cargo (matching rustc's option) which only affects rustc messages. (would it work to just pass this flag straight to rustc?)

Notes

This might not be the best way to go about what I'm trying to do, please let me know if that's the case.

@typecasto typecasto added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Aug 24, 2022
@weihanglo
Copy link
Member

weihanglo commented Aug 24, 2022

Thank you for submitting the issue, and welcome!
You might be interested in #8283, where more discussions happened. I'd in favour of that and close this :)

@weihanglo weihanglo closed this as not planned Won't fix, can't repro, duplicate, stale Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

2 participants