@@ -103,17 +103,15 @@ add_json_error() {
103103 local details=" ${3:- } "
104104 local exit_code=" ${4:- 1} "
105105
106- JSON_OUTPUT=$( echo " $JSON_OUTPUT " | jq --arg type " $type " --arg msg " $message " --arg details " $details " --argjson code " $exit_code " \
107- ' .errors += [{"type": $type, "message": $msg, "details": $details, "exit_code": $code}]' )
106+ JSON_OUTPUT=$( echo " $JSON_OUTPUT " | jq --arg type " $type " --arg msg " $message " --arg details " $details " --argjson code " $exit_code " ' .errors += [{"type": $type, "message": $msg, "details": $details, "exit_code": $code}]' )
108107}
109108
110109add_json_warning () {
111110 local module=" $1 "
112111 local message=" $2 "
113112 local type=" $3 "
114113
115- JSON_OUTPUT=$( echo " $JSON_OUTPUT " | jq --arg module " $module " --arg msg " $message " --arg type " $type " \
116- ' .warnings += [{"module": $module, "message": $msg, "type": $type}]' )
114+ JSON_OUTPUT=$( echo " $JSON_OUTPUT " | jq --arg module " $module " --arg msg " $message " --arg type " $type " ' .warnings += [{"module": $module, "message": $msg, "type": $type}]' )
117115}
118116
119117add_json_module () {
@@ -125,9 +123,7 @@ add_json_module() {
125123 local status=" $6 "
126124 local already_existed=" $7 "
127125
128- JSON_OUTPUT=$( echo " $JSON_OUTPUT " | jq --arg ns " $namespace " --arg name " $module_name " --arg path " $path " \
129- --arg version " $version " --arg tag " $tag_name " --arg status " $status " --argjson existed " $already_existed " \
130- ' .modules += [{"namespace": $ns, "module_name": $name, "path": $path, "version": $version, "tag_name": $tag, "status": $status, "already_existed": $existed}]' )
126+ JSON_OUTPUT=$( echo " $JSON_OUTPUT " | jq --arg ns " $namespace " --arg name " $module_name " --arg path " $path " --arg version " $version " --arg tag " $tag_name " --arg status " $status " --argjson existed " $already_existed " ' .modules += [{"namespace": $ns, "module_name": $name, "path": $path, "version": $version, "tag_name": $tag, "status": $status, "already_existed": $existed}]' )
131127}
132128
133129parse_arguments () {
@@ -235,11 +231,11 @@ extract_version_from_readme() {
235231 }
236232
237233 local version_line
238- version_line=$( grep -E " source\s*=\s *\" registry\.coder\.com/${namespace} /${module_name} " " $readme_path " | head -1 || echo " " )
234+ version_line=$( grep -E " source[[:space:]]*=[[:space:]] *\" registry\.coder\.com/${namespace} /${module_name} " " $readme_path " | head -1 || echo " " )
239235
240236 if [ -n " $version_line " ]; then
241237 local version
242- version=$( echo " $version_line " | sed -n ' s/.*version\s*=\s *"\([^"]*\)".*/\1/p' )
238+ version=$( echo " $version_line " | sed -n ' s/.*version[[:space:]]*=[[:space:]] *"\([^"]*\)".*/\1/p' )
243239 if [ -n " $version " ]; then
244240 log " DEBUG" " Found version '$version ' from source line: $version_line "
245241 echo " $version "
@@ -248,7 +244,7 @@ extract_version_from_readme() {
248244 fi
249245
250246 local fallback_version
251- fallback_version=$( grep -E ' version\s*=\s *"[0-9]+\.[0-9]+\.[0-9]+"' " $readme_path " | head -1 | sed ' s/.*version\s*=\s *"\([^"]*\)".*/\1/' || echo " " )
247+ fallback_version=$( grep -E ' version[[:space:]]*=[[:space:]] *"[0-9]+\.[0-9]+\.[0-9]+"' " $readme_path " | head -1 | sed ' s/.*version[[:space:]]*=[[:space:]] *"\([^"]*\)".*/\1/' || echo " " )
252248
253249 if [ -n " $fallback_version " ]; then
254250 log " DEBUG" " Found fallback version '$fallback_version '"
0 commit comments