-
Notifications
You must be signed in to change notification settings - Fork 295
/
debug
executable file
·87 lines (68 loc) · 1.54 KB
/
debug
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
set -euo pipefail
DEV_PATH=$(dirname "$0")
Error()
{
echo
exit 1
}
Include()
{
INCLUDE_PATH="$DEV_PATH"
include_name="$1"
while [[ $include_name =~ \/ ]]
do
INCLUDE_PATH="$INCLUDE_PATH/${include_name%%/*}"
include_name="${include_name#*/}"
done
shift
# shellcheck disable=SC1090
. "$INCLUDE_PATH/$include_name" "$@" || Error include $?
}
Include ver
Include env
Include core "$@"
Include utils/i18n "$@"
if [ -z "$*" ]
then
echo
debug_options=( '编译' '测试' )
inquirer list_input_index "选择操作" debug_options debug_options_index
if [ "$debug_options_index" -eq 0 ]
then
echo
inquirer list_input_index "是否部署" ny_options ny_index
if [ "$ny_index" -eq 0 ]
then
"$DEV_PATH"/make
else
"$DEV_PATH"/make install
fi
exit 0
elif [ "$debug_options_index" -eq 1 ]
then
self_options=()
for file in "$DEV_PATH"/src/*
do
if [ ! -d "$file" ]
then
self_options+=("${file##*/}")
fi
done
echo
inquirer list_input "选择测试的程序" self_options self
echo
inquirer text_input "输入参数" args_input "$i18n_blank"
if [ "$args_input" == "$i18n_blank" ]
then
args=()
else
IFS= read -ra args <<< "$args_input"
fi
fi
else
self=$1
shift
args=("${@:-}")
fi
Include src/"$self" "${args[@]}"