-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (35 loc) · 1.05 KB
/
Makefile
File metadata and controls
42 lines (35 loc) · 1.05 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
.PHONY: help shell-files format lint check clean
SHFMT_FLAGS := -i 4 -ci
SHELL_FILES_CMD := ./scripts/list_shell_files.sh
help:
@echo "Available commands:"
@echo " shell-files - Print discovered shell files"
@echo " format - Format discovered shell files with shfmt"
@echo " lint - Check formatting (shfmt diff)"
@echo " check - Alias for lint"
@echo " clean - Remove temporary files"
shell-files:
@$(SHELL_FILES_CMD)
format:
@echo "Formatting shell files..."
@files="$$( $(SHELL_FILES_CMD) )"; \
if [ -z "$$files" ]; then \
echo "No shell files found."; \
exit 0; \
fi; \
printf '%s\n' "$$files" | xargs shfmt -w $(SHFMT_FLAGS)
@echo "Formatting complete."
lint:
@echo "Checking shell formatting..."
@files="$$( $(SHELL_FILES_CMD) )"; \
if [ -z "$$files" ]; then \
echo "No shell files found."; \
exit 0; \
fi; \
printf '%s\n' "$$files" | xargs shfmt -d $(SHFMT_FLAGS)
@echo "Formatting check complete."
check: lint
clean:
@echo "Cleaning up..."
@find . -name "*.tmp" -delete
@echo "Clean complete."