-
Notifications
You must be signed in to change notification settings - Fork 2
/
entrypoint.sh
59 lines (49 loc) · 1.33 KB
/
entrypoint.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
55
56
57
58
59
#!/bin/bash
clj_watson_tag="${1}"
clj_watson_sha="${2}"
deps_edn_path="${3}"
aliases="${4}"
dependency_check_properties="${5}"
output_type="${6}"
fail_on_result="${7}"
suggestion_fix="${8}"
database_strategy="${9}"
output_file="${10}"
path="${11}"
output_cmd="clojure -Sdeps \"{:deps {io.github.clj-holmes/clj-watson {:git/tag \\\"${clj_watson_tag}\\\" :git/sha \\\"${clj_watson_sha}\\\"}}}\" -M -m clj-watson.cli scan -p ${deps_edn_path}"
if [[ -d ${path} ]]; then
cd ${path}
fi
if [[ ! -z $aliases ]]; then
IFS=','
read -a strarr <<< "$aliases"
for alias in "${strarr[@]}";
do
output_cmd="${output_cmd} -a ${alias}"
done
fi
if [[ $fail_on_result == "true" ]]; then
output_cmd="${output_cmd} --fail-on-result";
else
output_cmd="${output_cmd} --no-fail-on-result";
fi
if [[ ! -z $dependency_check_properties ]]; then
output_cmd="${output_cmd} -d ${dependency_check_properties}";
fi
if [[ ! -z $output_type ]]; then
output_cmd="${output_cmd} -o ${output_type}";
fi
if [[ $suggestion_fix == "true" ]]; then
output_cmd="${output_cmd} -s";
fi
if [[ ! -z $database_strategy ]]; then
output_cmd="${output_cmd} -t ${database_strategy}";
fi
if [[ ! -z $output_file ]]; then
output_cmd="${output_cmd} > ${output_file}";
fi
if [[ ! -z $output_file ]]; then
bash -c "${output_cmd}" > "$output_file"
else
bash -c "${output_cmd}"
fi