-
Notifications
You must be signed in to change notification settings - Fork 1
/
layers.sh
54 lines (43 loc) · 831 Bytes
/
layers.sh
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
# DEPRECATED
# use the golang files instead
LAYERS_DIR=('layers-comunicados' 'layers-atendimentos' 'tendaedu-web' 'tendaedu-backend')
layers-cli() {
echo "hello"
}
layers_dir() {
SRC=$PWD
BASE=${SRC##*/}
echo $BASE
}
layers_help() {
echo "HELP"
}
layers_node() {
NODE_VERSION="$(node --version)"
# check in nvmrc
if [[ -e .nvmrc ]]; then
DIR_VERSION="$(cat .nvmrc)"
SHORT="${DIR_VERSION::3}"
MAJOR_NODEVER="${NODE_VERSION::3}"
echo ${SHORT}
if [[ ${MAJOR_NODEVER} == ${SHORT} ]]; then
echo "okay"
else
echo "wrong ver"
fi
fi
}
main() {
COMMANDS=('dir' 'node' 'help')
echo
if [[ -n "$1" ]]; then
if [[ " ${COMMANDS[@]} " =~ " ${1} " ]]; then
layers_$1
else
echo "'$1' command not found"
fi
else
echo "show help"
fi
}
main $*