blob: 239270973cd4c98d27b99207bc7bcb05c325fcc8 (
plain) (
blame)
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
|
#!/usr/bin/env bash
# shellcheck shell=bash
# Shared helpers for the fmt / check-fmt / lint just recipes.
# Sourced from justfile recipe bodies; not standalone.
_need() {
command -v "$1" >/dev/null 2>&1 || {
printf 'error: %s not on PATH (install: %s)\n' "$1" "$2" >&2
exit 1
}
}
_find_shells() {
find . -type f \
\( -name '*.sh' \
-o -path './dot_local/bin/executable_*' \
-o -path './dot_config/sway/executable_*' \) \
-not -path './.git/*' -not -path './.worktrees/*'
}
_find_by_ext() {
find . -type f -name "*.$1" \
-not -path './.git/*' -not -path './.worktrees/*'
}
_find_zsh() {
find . -type f \
\( -name 'dot_zshrc' -o -name 'dot_zshenv' -o -name 'dot_zprofile' \) \
-not -path './.git/*' -not -path './.worktrees/*'
}
_is_zsh() {
case "$(basename "$1")" in
dot_zshrc | dot_zshenv | dot_zprofile | .zshrc | .zshenv | .zprofile) return 0 ;;
esac
return 1
}
_is_shellscript() {
head -1 "$1" 2>/dev/null | grep -qE '^#!.*\b(ba)?sh\b'
}
|