-
Notifications
You must be signed in to change notification settings - Fork 0
/
signal.nu
executable file
·29 lines (25 loc) · 922 Bytes
/
signal.nu
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
#!nu
def main [--build, ...args] {
if $build {
$args | to json | save --raw rebuild_signal -f
} else {
while true {
print "Listening for rebuild signal"
open --raw rebuild_signal | each {
let args = ($in | from json)
if ($args | is-empty) {
print "Received exit signal"
exit 0
}
clear
print $"(ansi grey)$ (ansi white)cargo (ansi grey)run -- (ansi white_bold)($args | str join ' ')(ansi reset)\n"
let build = (cargo run -- ...$args | complete)
if $build.exit_code == 0 {
print $"\n(ansi green)Process exited successfully(ansi reset)"
} else {
print $"\n(ansi red)Process did not exited successfully(ansi reset)"
}
}
}
}
}