As a user unfamiliar with Black I would like to customize the view of formatting results as in
black filename --diff .
If only I could pipe results as an input for a tool of choice to
Two options I could find:
$ black filename --diff -q - to use this output as an input I should parse it by +/- appearance (nontrivial)$ black filename -q ; git diff filename: PS I played around with piping between git diff --color-words or git diff --word-diff=color; diff -y (side-by-side view) and black filename -q | some-unix-command - for redirect... no luck
Try cat filename | black -
wow, thanks @zsol !
For those who come after:
To see changes side-by-side.
$ cat filename.py | black -q - | diff -y --color filename.py -
Only new or deleted lines are highlighted. Changed - not.
Side-by-side, colored. Requires colordiff tool
$ cat filename.py | black -q - | diff -y filename.py - | colordiff
Version for git diff because it has some nice options too
$ cat filename.py | black -q - | git diff --color-words --no-index -- filename.py -
FWIW, abusing cat | like that is inefficient. Use file redirection instead: black -q - < $filename
Most helpful comment
FWIW, abusing
cat |like that is inefficient. Use file redirection instead:black -q - < $filename