-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathjustfile
More file actions
146 lines (119 loc) Β· 3.46 KB
/
justfile
File metadata and controls
146 lines (119 loc) Β· 3.46 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
set shell := ["bash", "-Eeuo", "pipefail", "-c"]
default:
@just --list --unsorted
check-format: shell-check-format nix-check-format
fix-format:
@echo "π Fixing all formatting..."
@just shell-fix-format
@just nix-fix-format
@echo "β
All formatting fixed!"
check-code:
@echo "π Checking all code quality..."
@just shell-check-code
@echo "β
All code quality checks passed!"
shell-ls:
#!/usr/bin/env bash
set -euo pipefail
# Find .sh files and bin/* files, but exclude non-shell scripts and common directories
find . \( -name node_modules -o -name .git -o -name .cache \) -prune -o \
\( -name '*.sh' -o -path './bin/*' \) -type f -not -type l -print 2>/dev/null | while read -r file; do
# Check if file has a shell shebang
if head -n1 "$file" | grep -qE '^#!/.*(bash|sh|zsh)'; then
echo "$file"
fi
done | sort
# Check shell formatting
shell-check-format:
#!/usr/bin/env bash
set -euo pipefail
files=$(just shell-ls)
[ -z "$files" ] && echo "β
No shell scripts" && exit 0
echo "π Checking shell formatting..."
if echo "$files" | xargs -r shfmt -d -i 2; then
echo "β
Shell formatting OK"
else
echo "β Format issues (run: just shell-fix-format)"
exit 1
fi
shell-check-code:
#!/usr/bin/env bash
set -euo pipefail
files=$(just shell-ls)
[ -z "$files" ] && echo "β
No shell scripts" && exit 0
echo "π Checking shell code..."
if command -v shellcheck >/dev/null 2>&1; then
if echo "$files" | xargs -r shellcheck; then
echo "β
Shellcheck OK"
else
echo "β Shellcheck issues found"
exit 1
fi
else
echo "β οΈ shellcheck not installed, skipping"
fi
# Fix shell formatting
shell-fix-format:
#!/usr/bin/env bash
set -euo pipefail
files=$(just shell-ls)
[ -z "$files" ] && echo "β
No shell scripts" && exit 0
echo "π Fixing shell formatting..."
echo "$files" | xargs -r shfmt -w -i 2 2>/dev/null || true
echo "β
Done"
# Combined check
shell-check: shell-check-format shell-check-code
# Combined fix
shell-fix: shell-fix-format
nix-ls:
@find . -name '*.nix' -type f -not -type l -print 2>/dev/null | sort
# Check Nix formatting
nix-check-format:
#!/usr/bin/env bash
set -euo pipefail
files=$(just nix-ls)
[ -z "$files" ] && echo "β
No Nix files" && exit 0
echo "π Checking Nix formatting..."
if command -v nixfmt >/dev/null 2>&1; then
if echo "$files" | xargs -r nixfmt --check; then
echo "β
Nix formatting OK"
else
echo "β Format issues (run: just nix-fix-format)"
exit 1
fi
else
echo "β οΈ nixfmt not installed, skipping"
fi
# Fix Nix formatting
nix-fix-format:
#!/usr/bin/env bash
set -euo pipefail
files=$(just nix-ls)
[ -z "$files" ] && echo "β
No Nix files" && exit 0
echo "π Fixing Nix formatting..."
if command -v nixfmt >/dev/null 2>&1; then
echo "$files" | xargs -r nixfmt
echo "β
Done"
else
echo "β οΈ nixfmt not installed, skipping"
fi
# Combined check
nix-check: nix-check-format
# Combined fix
nix-fix: nix-fix-format
# Run neovim flake
rvim-run:
cd config/rvim && nix run .#
alias rvim := rvim-run
# Show neovim flake output
rvim-show:
cd config/rvim && nix flake show
# Update neovim flake
rvim-update:
cd config/rvim && nix flake update
# Check neovim flake
rvim-check:
cd config/rvim && nix flake check
secrets-edit:
sops private/secrets/common.yaml
secrets-view:
sops -d private/secrets/common.yaml