show diff of combined script
#!/usr/bin/env bash
-output=./bin/brew-file
+dest="./bin/brew-file"
+tmp_backup=$(mktemp -t brew-file)
+mv "$dest" "$tmp_backup"
+echo "Old brew-file was moved to $tmp_backup"
+
{
echo "#!/usr/bin/env python3"
grep -E "(^from|^import)" src/brew_file/*.py|grep -v "from \."| cut -d ":" -f2| sort -u
@@ -11,9 +15,12 @@ output=./bin/brew-file
grep -vE "(^from|^import)" < src/brew_file/brew_info.py
grep -vE "(^from|^import)" < src/brew_file/brew_file.py
grep -vE "(^from|^import)" < src/brew_file/main.py
-} > $output
+} > "$dest"
+
+black "$dest"
+isort "$dest"
+autoflake --in-place "$dest"
+autopep8 --in-place "$dest"
-black $output
-isort $output
-autoflake --in-place $output
-autopep8 --in-place $output
+diff -u "$tmp_backup" "$dest"
+chmod 755 "$dest"
