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
|
#! /usr/bin/env bash
# Define endpoint
endpoint_url="https://kitcreator.rkeene.org/kitcreator"
# Help
function print_help() {
echo 'download-api-client [--platform <platform>] [--tcl-version <version>]'
echo ' [--kitcreator-version <version>] [--kitdll]'
echo ' [--threaded] [--debug] [--dynamictk]'
echo ' [--staticpkgs] [--verbose]'
echo 'download-api-client {--help|--platforms|--tcl-versions|'
echo ' --kitcreator-versions|--packages}'
}
# Set arguments
declare -A jsonArgs
jsonArgs["platform"]="$(uname -s)-$(uname -m)"
nextArg=''
kit_filename=''
options=()
packages=()
internalOptionsVerbose='false'
for arg in "$@"; do
if [ -n "${nextArg}" ]; then
jsonArgs["${nextArg}"]="${arg}"
nextArg=''
continue
fi
case "${arg}" in
--verbose)
internalOptionsVerbose='true'
;;
--platform|--tcl-version|--kitcreator-version)
nextArg="${arg:2}"
nextArg="${nextArg//-/_}"
;;
--kitdll|--threaded|--debug|--dynamictk|--staticpkgs)
options+=("${arg:2}")
;;
--mk4tcl|--tcc4tcl|--tclcurl|--tk|--tls|--tuapi|--itcl|--duktape|--lmdb|--udp)
packages+=("${arg:2}")
;;
--platforms|--tcl-versions|--kitcreator-versions|--packages|--options)
action="${arg:2}"
action="${action//-/_}"
formatString='%-20s | %s\n'
printf "${formatString}" Name Description
|
|
>
|
>
>
|
>
>
>
|
>
>
>
>
>
|
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
|
#! /usr/bin/env bash
# Define endpoint
endpoint_url="https://kitcreator.rkeene.org/kitcreator"
# Help
function print_help() {
echo 'download-api-client [--platform <platform>] [--tcl-version <version>]'
echo ' [--kitcreator-version <version>] [--kitdll]'
echo ' [--threaded] [--debug] [--dynamictk]'
echo ' [--staticpkgs] [--verbose] [--pkg-<package>...]'
echo ' [--opt-<option>...] [--empty-packages]'
echo 'download-api-client {--help|--platforms|--tcl-versions|'
echo ' --kitcreator-versions|--packages|'
echo ' --options}'
}
# Set arguments
declare -A jsonArgs
jsonArgs["platform"]="$(uname -s)-$(uname -m)"
nextArg=''
kit_filename=''
options=()
packages=()
internalOptionsVerbose='false'
noPackages='false'
for arg in "$@"; do
if [ -n "${nextArg}" ]; then
jsonArgs["${nextArg}"]="${arg}"
nextArg=''
continue
fi
case "${arg}" in
--verbose)
internalOptionsVerbose='true'
;;
--platform|--tcl-version|--kitcreator-version)
nextArg="${arg:2}"
nextArg="${nextArg//-/_}"
;;
--kitdll|--threaded|--debug|--dynamictk|--staticpkgs)
options+=("${arg:2}")
;;
--opt-*)
options+=("${arg:6}")
;;
--pkg-*)
packages+=("${arg:6}")
noPackages='false'
;;
--empty-packages)
packages=()
noPackages='true'
;;
--platforms|--tcl-versions|--kitcreator-versions|--packages|--options)
action="${arg:2}"
action="${action//-/_}"
formatString='%-20s | %s\n'
printf "${formatString}" Name Description
|
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
esac
done
if [ -n "${options[*]}" ]; then
jsonArgs["options"]="${options[*]}"
fi
if [ -n "${packages[*]}" ]; then
jsonArgs["packages"]="${packages[*]}"
fi
# Convert arguments into a request
jqArgs=()
jqSettings=''
for jsonArg in "${!jsonArgs[@]}"; do
|
|
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
esac
done
if [ -n "${options[*]}" ]; then
jsonArgs["options"]="${options[*]}"
fi
if [ -n "${packages[*]}" -o "${noPackages}" = 'true' ]; then
jsonArgs["packages"]="${packages[*]}"
fi
# Convert arguments into a request
jqArgs=()
jqSettings=''
for jsonArg in "${!jsonArgs[@]}"; do
|