File: blackify.sh

package info (click to toggle)
python-imageio 2.37.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,684 kB
  • sloc: python: 26,302; makefile: 138
file content (14 lines) | stat: -rwxr-xr-x 363 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash

# Read JSON input from stdin
json_input=$(cat)

# Extract the file path that was edited
file_path=$(echo "$json_input" | jq -r '.file_path // empty')

# Format the modified file with black (only Python files)
if [ -n "$file_path" ] && ([[ $file_path == *.py ]] || [[ $file_path == *.pyi ]]); then
    uv run black "$file_path" 2>/dev/null
fi

exit 0