-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (39 loc) · 1.2 KB
/
Copy pathMakefile
File metadata and controls
43 lines (39 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Makefile for docker-claude-code
CLAUDE_IMAGE ?= ghcr.io/gw0/docker-claude-code:main
SHELL := /bin/bash
.PHONY: build fmt
build:
docker build --progress=plain -t $(CLAUDE_IMAGE) .
fmt:
@errors=0; \
\
echo "Formatting *.sh scripts..."; \
git ls-files -- '*.sh' \
| xargs -r shfmt -l -w -i 2 || ((errors++)); \
git ls-files -- '*.sh' \
| xargs -r shellcheck || ((errors++)); \
\
echo "Formatting shell scripts without extension..."; \
git ls-files \
| awk -F/ '$$NF !~ /\./' \
| xargs -r grep -lm1 "^#!/bin/\(ba\)\?sh" 2>/dev/null \
| xargs -r shfmt -l -w -i 2 || ((errors++)); \
git ls-files \
| awk -F/ '$$NF !~ /\./' \
| xargs -r grep -lm1 "^#!/bin/\(ba\)\?sh" 2>/dev/null \
| xargs -r shellcheck || ((errors++)); \
\
echo "Formatting Dockerfile files..."; \
git ls-files -- 'Dockerfile*' \
| xargs -r dockerfmt --write || ((errors++)); \
\
echo "Formatting YAML files..."; \
git ls-files -- '*.yml' '*.yaml' \
| xargs -r yamlfmt || ((errors++)); \
\
echo "Formatting Markdown files..."; \
git ls-files -- '*.md' \
| xargs -r markdownlint-cli2 --fix --no-globs >/dev/null || ((errors++)); \
\
echo "Done (errors: $${errors})"; \
exit $${errors}