I am currently our public command-line tool some love and although we officially have an `--output=json` flag, it rarely works or does anything useful.<p>* While thinking about how to fix/implement this for more commands I was wondering if this kind of more structured output is actually of interest/use for developers/devops/SRE?<p>Some context: The tool in question is a client for our API and used for validation + updating resources and triggering long running loadtest jobs. Users are developers, although we also recommend it for integration into CI/CD pipelines etc.<p>Any feedback is welcome :)
If the idea is to have output from CLI apps/scripts that can be easily parsed so that chaining scripts together without regexing yourself to death is the goal this sounds like what PowerShell Core (which runs on macOS and Linux as well) does: PS commands return objects -- with a default .ToString() output if you don't grab the result and use it in the next step/script -- allowing easy object.property accessors as well as foreach iteration if the command returns a list/array of objects.
If your json-vs-text output drifts often, you could make the backing objects the same. AWS kind of does it in their cli tool. It's all objects and json inside, but you see nicely rendered tables. "--output=json" gives you the real/raw data.