Initial commit
This commit is contained in:
15
hooks/hooks.json
Normal file
15
hooks/hooks.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"hooks": {
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "jq -r '.tool_input.file_path' | { read file_path; if echo \"$file_path\" | grep -q '\\.py$'; then \"$CLAUDE_PLUGIN_ROOT\"/hooks/python_format.sh \"$file_path\"; fi; }"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
10
hooks/python_format.sh
Executable file
10
hooks/python_format.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -u
|
||||
|
||||
uvx hatch fmt "$1" 1>&2
|
||||
exit_code=$?
|
||||
if [ $exit_code -eq 1 ]; then
|
||||
exit 2
|
||||
else
|
||||
exit $exit_code
|
||||
fi
|
||||
Reference in New Issue
Block a user