-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathorg
executable file
·64 lines (56 loc) · 1.39 KB
/
org
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
#!/usr/bin/env bash
function build() {
doom publish
}
function dev() {
mkdir -p out
npx live-server out &
build
while true; do
changes=()
while read -r -t 1 change; do
changes+=("$change")
done
if [[ "${#changes[@]}" -ne 0 ]]; then
for change in "${changes[@]}"; do
echo $change
done
build &
fi
done < <(inotifywait --monitor \
--recursive \
--event modify \
--event move \
--event create \
--event delete \
--event attrib \
--exclude "(/\..+)|(out)|(flycheck*)" \
--quiet \
.)
}
function main() {
trap 'exit' TERM INT
trap 'kill 0' EXIT
command="$1"
case $command in
"" | "-h" | "--help")
echo "Usage: org build|dev"
echo " build: performs a one time build"
echo " dev: builds, starts a file server, and watches file changes to trigger rebuilds"
;;
build)
echo "=> Starting a one off build..."
build
;;
dev)
echo "=> Starting development..."
dev
;;
*)
echo "Error: '$command' is not a supported command." >&2
echo " Run '$0 --help' for a list of commands ." >&2
exit 1
;;
esac
}
main "$@"