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

Add option to store output in a file (json) #664

Closed
ilyapuchka opened this issue Aug 17, 2018 · 7 comments
Closed

Add option to store output in a file (json) #664

ilyapuchka opened this issue Aug 17, 2018 · 7 comments

Comments

@ilyapuchka
Copy link
Collaborator

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?

@krzysztofzablocki
Copy link
Owner

fine with me, we already have the data and could just as well generate the boilerplate for json generation

@Antondomashnev
Copy link
Collaborator

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.

@1is10
Copy link
Contributor

1is10 commented Sep 16, 2022

Hi guys,
I just want to realise json output to std, i read contribution guide and found this topic 🙌

I have a POC here 1is10#1

is it what are you talking about or should I create another topic to discuss that one?

@krzysztofzablocki
Copy link
Owner

@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

@1is10
Copy link
Contributor

1is10 commented Sep 21, 2022

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

@krzysztofzablocki
Copy link
Owner

krzysztofzablocki commented Sep 22, 2022

@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

@1is10
Copy link
Contributor

1is10 commented Sep 26, 2022

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:
#1097

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants