Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions .claude/scripts/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,30 +101,36 @@ fi
# Get the file extension to determine the appropriate formatter
file_ext="${file_path##*.}"

# Helper function to run formatter and handle errors
run_formatter() {
local target="$1"
local file_type="$2"

if ! make FILE="$file_path" "$target"; then
echo "Error: Failed to format $file_type file: $file_path" >&2
exit 2
fi
echo "✓ Formatted $file_type file: $file_path"
}
# Change to the project root directory (where the Makefile is located)
cd "$(dirname "$0")/../.."

# Call the appropriate Makefile target based on file extension
case "$file_ext" in
go)
make fmt/go FILE="$file_path"
echo "✓ Formatted Go file: $file_path"
run_formatter "fmt/go" "Go"
;;
js | jsx | ts | tsx)
make fmt/ts FILE="$file_path"
echo "✓ Formatted TypeScript/JavaScript file: $file_path"
run_formatter "fmt/ts" "TypeScript/JavaScript"
;;
tf | tfvars)
make fmt/terraform FILE="$file_path"
echo "✓ Formatted Terraform file: $file_path"
run_formatter "fmt/terraform" "Terraform"
;;
sh)
make fmt/shfmt FILE="$file_path"
echo "✓ Formatted shell script: $file_path"
run_formatter "fmt/shfmt" "shell script"
;;
md)
make fmt/markdown FILE="$file_path"
echo "✓ Formatted Markdown file: $file_path"
run_formatter "fmt/markdown" "Markdown"
;;
*)
echo "No formatter available for file extension: $file_ext"
Expand Down
234 changes: 205 additions & 29 deletions coderd/apidoc/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading