Add support for the --fix flag
- ID
fd7d6de- date
2025-05-01 08:25:42+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
e4bb7c4- message
Add support for the `--fix` flag- changed files
1 file, 11 additions, 2 deletions
Changed files
python/pyfmt (868) → python/pyfmt (1046)
diff --git a/python/pyfmt b/python/pyfmt
index cb25559..6c746e2 100755
--- a/python/pyfmt
+++ b/python/pyfmt
@@ -16,6 +16,9 @@ set -o nounset
if (( $# == 0 ))
then
ROOT="$(pwd)"
+elif [[ "$#" = "1" && "$1" = "--fix" ]]
+then
+ ROOT="$(pwd)"
else
ROOT="$@"
fi
@@ -36,8 +39,14 @@ else
fi
-print_info "-> ruff check"
-bash -c "$RUFF check $ROOT"
+if [[ "${1:-}" == "--fix" ]]
+then
+ print_info "-> ruff check --fix"
+ bash -c "$RUFF check $ROOT --fix"
+else
+ print_info "-> ruff check"
+ bash -c "$RUFF check $ROOT"
+fi
echo ""