Sourcery
Sourcery copied to clipboard
Add option to store output in a file (json)
Sourcekitten has the option to store structure output in the file so that it can be then used by other tools. We can do the same to enable other tools to act on types metadata. @krzysztofzablocki @Antondomashnev thoughts?
fine with me, we already have the data and could just as well generate the boilerplate for json generation
Sorry for the late reply. If that isn't much of a work + could be useful for other tools (do we have any request for it btw?) I think it's a good enhancement.
Hi guys, I just want to realise json output to std, i read contribution guide and found this topic 🙌
I have a POC here https://github.com/1is10/Sourcery/pull/1
is it what are you talking about or should I create another topic to discuss that one?
@1is10 what's your use-case for json output nowadays? we moved Sourcery to work as framework so one can build tools on top of Sourcery without using intermediate formats like json
My first thoughts about json stdout was
- dry run, it's useful for many cases for example to count autogenerated code lines, or by CI to check errors during code generation, without write on disk
- post processing output without modifying templates in any script language
- building tools in other languages, without linking sourcery framework directly
@1is10 ok, I'd be fine with adding feature like that if we can isolate the functionality not to add too much complexity to the tool
i implemented it with --dry
flag, and made a pull request
here + ready to fix any issues related about isolation and overall logic, tested locally + added some tests for --dry
option.
pull request link: https://github.com/krzysztofzablocki/Sourcery/pull/1097