12
12
main () {
13
13
script_path=" $argc_script_path "
14
14
if [[ ! -f " $script_path " ]]; then
15
- _exit " ✗ not found $script_path "
15
+ echo " ✗ not found $script_path "
16
+ exit 0
16
17
fi
17
18
ext=" ${script_path##* .} "
18
19
if [[ " $script_path " == tools/* ]]; then
@@ -39,30 +40,39 @@ check_sh_dependencies() {
39
40
fi
40
41
done
41
42
if [[ -n " ${missing_deps} " ]]; then
42
- _exit " ✗ missing tools: ${missing_deps[*]} "
43
+ echo " ✗ missing tools: ${missing_deps[*]} "
43
44
fi
44
45
}
45
46
46
47
check_agent_js_dependencies () {
47
48
agent_dir=" $( dirname " $script_path " ) "
48
49
if [[ -f " $agent_dir /package.json" ]]; then
49
50
npm ls --prefix=" $agent_dir " --depth=0 --silent > /dev/null 2>&1 || \
50
- _exit " ✗ missing node modules, FIX: cd $agent_dir && npm install"
51
+ {
52
+ cmd=" cd $agent_dir && npm install"
53
+ echo " ✗ missing node modules"
54
+ read -p " ? run \` $cmd \` to fix [Y/n] " choice
55
+ if [[ " $choice " == " Y" || " $choice " == " y" || -z " $choice " ]]; then
56
+ (eval " $cmd " )
57
+ fi
58
+ }
51
59
fi
52
60
}
53
61
54
62
check_agent_py_dependencies () {
55
63
agent_dir=" $( dirname " $script_path " ) "
56
64
if [[ -f " $agent_dir /requirements.txt" ]]; then
57
65
python <( cat " $agent_dir /requirements.txt" | sed -E -n ' s/^([A-Za-z_]+).*/import \1/p' ) > /dev/null 2>&1 || \
58
- _exit " ✗ missing python modules, FIX: cd $agent_dir && pip install -r requirements.txt"
66
+ {
67
+ cmd=" cd $agent_dir && pip install -r requirements.txt"
68
+ echo " ✗ missing python modules"
69
+ read -p " ? run \` $cmd \` to fix [Y/n] " choice
70
+ if [[ " $choice " == " Y" || " $choice " == " y" || -z " $choice " ]]; then
71
+ (eval " $cmd " )
72
+ fi
73
+ }
59
74
fi
60
75
}
61
76
62
- _exit () {
63
- echo " $* " >&2
64
- exit 0
65
- }
66
-
67
77
# See more details at https://github.com/sigoden/argc
68
78
eval " $( argc --argc-eval " $0 " " $@ " ) "
0 commit comments