Created
June 25, 2015 12:51
-
-
Save NichtJens/89137829a1d2acf64ec6 to your computer and use it in GitHub Desktop.
Create a temporary autopep8'ed version of a Python script and diff(meld/diffuse) it with the original
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o nounset | |
set -o errexit | |
if [ "$#" == "0" ]; then | |
echo "usage: $0 [autopep8 options] input.py" | |
exit 1 | |
fi | |
ap8ed=$(mktemp) | |
input=$@ | |
infile=( $( for i in ${input[@]}; do echo $i; done | grep .py$ ) ) | |
differs="diff meld diffuse" | |
for d in $differs; do | |
command -v $d >/dev/null && differ=$d | |
done | |
autopep8 --max-line-length=999 $input > "$ap8ed" | |
echo "$differ - original: $infile vs. autopep8ed: $ap8ed" | |
"$differ" "$infile" "$ap8ed" | |
rm "$ap8ed" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment