diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f4e4a30..c455df7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,8 @@ repos: - repo: local hooks: - - id: rust-format - name: Rust Format - entry: ./rs_fmt.sh + - id: project-format + name: Project Format + entry: ./fmt.sh language: script stages: [commit] \ No newline at end of file diff --git a/fmt.sh b/fmt.sh new file mode 100755 index 0000000..cb98994 --- /dev/null +++ b/fmt.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +for dir in core_lib frontend/src-tauri; do + find "$dir" -name '*.rs' -not -path "*/target/*" -exec rustfmt {} + +done + +# Check if there are changes in the /frontend/src directory +if git diff --name-only HEAD | grep '^frontend/src/' >/dev/null; then + echo "Changes detected in /frontend/src. Executing script..." + + # Navigate to the frontend/src-tauri directory + cd frontend/src-tauri + + # Run your commands + pnpm lint --fix +else + echo "No changes detected in /frontend/src." +fi diff --git a/rs_fmt.sh b/rs_fmt.sh deleted file mode 100755 index 4569270..0000000 --- a/rs_fmt.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -for dir in core_lib frontend/src-tauri; do - find "$dir" -name '*.rs' -not -path "*/target/*" -exec rustfmt {} + -done \ No newline at end of file