-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathintellij-http-client-action.sh
executable file
·70 lines (55 loc) · 1.51 KB
/
intellij-http-client-action.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
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
function option {
local -n _options=$1
local _name=$2
local _value=$3
if [[ ! -z "$_value" ]]; then
_options+=("--$_name=$_value")
fi
}
function flag {
local -n _options=$1
local _name=$2
local _value=$3
if [[ "$_value" == "true" ]]; then
_options+=("--$_name")
fi
}
function values {
local -n _options=$1
local _name=$2
local _value=$3
declare -a _values
if [[ ! -z "$_value" ]]; then
while IFS=$'\n' read -r value ; do
_options+=("--$_name=$value")
done <<< "$_value"
fi
}
declare -a files
while IFS=$'\n' read -r file ; do
files+=("$file");
done <<< "$INPUT_FILES"
declare -a options
option options 'socket-timeout' "${INPUT_SOCKET_TIMEOUT}"
option options 'connect-timeout' "${INPUT_CONNECT_TIMEOUT}"
flag options 'insecure' "${INPUT_INSECURE}"
option options 'env' "${INPUT_ENV}"
option options 'env-file' "${INPUT_ENV_FILE}"
values options 'env-variables' "${INPUT_ENV_VARIABLES}"
option options 'private-env-file' "${INPUT_PRIVATE_ENV_FILE}"
values options 'private-env-variables' "${INPUT_PRIVATE_ENV_VARIABLES}"
# https://youtrack.jetbrains.com/issue/IDEA-314789/IntelliJ-HTTP-Client-ignores-proxy-settings
option options 'proxy' "${INPUT_PROXY}"
flag options 'docker-mode' "${INPUT_DOCKER_MODE}"
option options 'log-level' "${INPUT_LOG_LEVEL}"
flag options 'report' "${INPUT_REPORT}"
(
set -x;
java \
-cp '/intellij-http-client/*' \
com.intellij.httpClient.cli.HttpClientMain \
"${options[@]}" \
-- \
"${files[@]}"
)