-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathautohyde
executable file
·65 lines (55 loc) · 1.14 KB
/
autohyde
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
#!/bin/bash
ref=.autohyderef
current=$(basename $PWD)
# echo with prefix
function e {
echo -en "\033[01;34mAutoHyde : \033[00m"
echo "$1"
}
# echo and run growlnotify if installed
function eg {
if which -s growlnotify; then
growlnotify -n AutoHyde -m "$1" AutoHyde
fi
e "$1"
}
# Create a file called $ref if it doesn't exist already
# We will touch this file whenever we run hyde gen so that
# we can determine whether any files have been modified
# since the last hyde gen
if [ ! -f $ref ];
then
hyde gen
touch .autohyderef
fi
# kill existing hyde servers
function killhyde()
{
if jobs -l hyde 2> /dev/null; then
e "Killing hyde serve"
kill $(jobs -l hyde | awk '{print $2}')
fi
}
# spawn a new server in the background
killhyde
e "Launching hyde serve"
hyde serve &
e "Press Ctrl-C to exit"
# run if user hits control-c
function control_c()
{
killhyde
exit $?
}
trap control_c SIGINT
while :
do
if find . -newer $ref | grep -q -v $ref; then
eg "Running hyde gen in $current"
#killhyde
hyde gen
#hyde serve &
touch $ref
fi
sleep 1
done