Re: [GSoC RFC PATCH v4 2/4] repo: add the field references.format
From: Justin Tobler <hidden>
Date: 2025-07-16 14:10:24
On 25/07/16 07:38AM, Patrick Steinhardt wrote:
On Tue, Jul 15, 2025 at 02:15:07PM -0500, Justin Tobler wrote:quoted
Also, as mentioned in a comment for the previous patch, maybe we should support printing two output modes. For the default output, maybe a simple `<key>=<value>\n` where the any value containing special characters is quoted via `quote_c_style()`. A null-terminated output, such as the one proposed in this patch, could be enabled via a `-z` flag similar to how its done in other commands.Agreed in general, but instead of using `-z` I wonder whether it would make sense to use something like `--format=key-value` and `--format=nul` instead. This gives us more room to introduce additional formats in the future, like for example the JSON format that was scrapped for now.
If we already plan to support additional output formats, they I agree we should probably a `--format=<output-type>` flag from the start. I still think it would be nice to have a `-z` flag that is shorthand for `--format=nul` though as that is fairly common across other commands to have such an option. Out of curiousity, is there a reason we are interested in supporting a JSON output format in addition to what is already proposed? From an earlier conversation I had with Lucas, it didn't seem like there was any particular reason for JSON. -Justin