pyformat icon indicating copy to clipboard operation
pyformat copied to clipboard

show diff only when --diff

Open misho104 opened this issue 6 years ago • 3 comments

The current behavior of pyformat is different from autopep8, which returns diff only when --diff option is specified and otherwise returns the whole file content. It would be nice if the behavior of pyformat, which currently returns diff always, could be the same as autopep8, because then users can use pyformat just by replacing their autopep8 to pyformat.

For example, this issue of vscode is solved and vscode users can use pyformat with a simple modification of their configuration.

misho104 avatar Jan 25 '19 16:01 misho104

Coverage Status

Coverage remained the same at 100.0% when pulling 5d21b07a8cc3f1a74b5973f2769b1599e1fd4c4a on misho104:diff_option into 7293e4dd46433b56bb9224ce0a19f616a231c0ed on myint:master.

coveralls avatar Jan 25 '19 17:01 coveralls

Thanks! To preserve backward compatibility, let's make an option to print out the whole file. Leave the current behavior as the default. Note that the diff-by-default behavior matches some other other tools (autoflake, unify, etc.).

Also, I don't think it should allow printing out the whole file if there are multiple files being checked. This would risk someone accidentally concatenating multiple files into a single file.

myint avatar Jan 27 '19 15:01 myint

Fair enough, and i agree on it! I'll try to do such when I have spare time.

misho104 avatar Feb 02 '19 11:02 misho104