refactor: make scripts/create.sh works on bash 3 (#28)

This commit is contained in:
sigoden
2024-06-06 16:35:37 +08:00
committed by GitHub
parent 39447fb39e
commit 6d1ad27900
+4 -4
View File
@@ -83,15 +83,15 @@ build_properties() {
properties=''
for param in "${argc_params[@]}"; do
if [[ "$param" == *'!' ]]; then
param="${param::-1}"
param="${param:0:$((${#param}-1))}"
required_params+=("$param")
property='{"'"$param"'":{"type":"string","description":""}}'
elif [[ "$param" == *'+' ]]; then
param="${param::-1}"
param="${param:0:$((${#param}-1))}"
required_params+=("$param")
property='{"'"$param"'":{"type":"array","description":"","items": {"type":"string"}}}'
elif [[ "$param" == *'*' ]]; then
param="${param::-1}"
param="${param:0:$((${#param}-1))}"
property='{"'"$param"'":{"type":"array","description":"","items": {"type":"string"}}}'
else
property='{"'"$param"'":{"type":"string","description":""}}'
@@ -106,7 +106,7 @@ build_properties() {
required+="\"$param\","
done
if [[ -n "$required" ]]; then
required="${required::-1}"
required="${required:0:$((${#required}-1))}"
required+="]"
fi
echo '{