-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathr
executable file
·51 lines (43 loc) · 980 Bytes
/
r
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
#!/bin/bash
cd $(dirname "${BASH_SOURCE[0]}")
declare gpath=$("pwd")
declare project=""
if [[ $gpath =~ (.*\/)(.*) ]]; then
project=${BASH_REMATCH[2]}
fi
export GOPATH="$gpath"
declare bin="$gpath/bin"
declare binka="$bin/$project"
declare src="$gpath/src/$project"
declare par=$1
if [[ $par == "b" ]]; then
cd "$src"
# declare err=$(go install -race 2>&1>/dev/null)
declare err=$(go install 2>&1>/dev/null)
if [[ ! -z $err ]]; then
echo "$err"
printf '─%.s' $(seq 50)
echo
exit 0
fi
if [[ -e $binka ]]; then
echo "$project OK"
printf '─%.s' $(seq 50)
echo
exit 0
fi
echo "$binka not found"
exit -1
fi
if [[ $par ]]; then
echo -e "\nThe parameter \"$par\" is wrong\n"
exit -1
fi
if [[ -e $binka ]]; then
cd $bin
echo -en "\033]0;$project\a"
# GORACE="log_path=$bin/rc halt_on_error=1" $binka
$binka
else
echo -e "$binka not found\n"
fi