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

Allow getting fixed/converted file on stdout #25

Closed
kwesolowski opened this issue Jan 19, 2018 · 8 comments
Closed

Allow getting fixed/converted file on stdout #25

kwesolowski opened this issue Jan 19, 2018 · 8 comments

Comments

@kwesolowski
Copy link

Similar to clang-format behavior when one can select in place or stdout as target.

It would give more flexibility when integrated into bigger tool suite (i.e. code format, fix include guards in single pass).

@cgmb
Copy link
Owner

cgmb commented Jan 21, 2018

Interesting. I hadn't thought of that sort of use, but it's a good idea.

@kwesolowski
Copy link
Author

kwesolowski commented Jan 24, 2018 via email

@cgmb
Copy link
Owner

cgmb commented Jan 25, 2018

I am pretty busy, but I'm not sure it makes much difference who does it. The code should be simple enough, so the real work is figuring out the interface design. Whether I'm writing or reviewing, I'll need to give a little thought to what that argument should look like and what the behaviour should be when more than one input file is given.

Proper support for tool integration should probably also include accepting input from stdin. That's a little more tricky because the file path is usually important. I see that clang-format has an -assume-filename= option to deal with this. That's an ok solution, I guess. So, we'd have --assume-filepath=.

I'll give it some thought and maybe put something together this weekend.

@kwesolowski
Copy link
Author

kwesolowski commented Jan 25, 2018

Sounds good - I do not think we need to handle any multifile/recursive scenarios with this approach (clang does not afair).

@cgmb
Copy link
Owner

cgmb commented Jan 31, 2018

I figure I'll add --stdio and --assume-filepath=<file> flags to all utilities.

@kwesolowski
Copy link
Author

kwesolowski commented Jan 31, 2018 via email

@cgmb cgmb closed this as completed in 60d7227 Feb 7, 2018
@cgmb
Copy link
Owner

cgmb commented Feb 7, 2018

Good point. Taking input on stdin would pretty much force you to use --assume-filepath=<path>, which is annoying if you don't really care about getting input via stdin. I added a standalone --stdout option in v2.3.0.

Input on stdin was cut because it required some refactoring to fit in, and I don't have time right now to test everything it would touch. I should probably write more automated tests, because manually testing across three platforms and two Python versions is a real pain!

@kwesolowski
Copy link
Author

kwesolowski commented Feb 7, 2018 via email

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

No branches or pull requests

2 participants