Fix broken index update with plugins missing an info field.

This commit is contained in:
Jorge Bucaran 2016-05-07 03:56:32 +09:00
parent 980498603d
commit 41a0b0e032
No known key found for this signature in database
GPG key ID: E54BA3C0E646DB30

View file

@ -984,19 +984,17 @@ function __fisher_remote_index_update
quicksort(list, j + 1, hi)
}
function field_parse(s) {
if ($0 ~ "^" s ":") {
return substr($0, length(s) + 3)
}
}
{
name = (s = field_parse("name")) ? s : name
info = (s = field_parse("description")) ? s : info
stars = (s = field_parse("stargazers_count")) ? s : stars
name = ($0 ~ /^name: /) ? substr($0, 7) : name
info = ($0 ~ /^description: /) ? substr($0, 14) : info
stars = ($0 ~ /^stargazers_count: /) ? substr($0, 19) : stars
if (name && stars != "") {
url = "github.com/fisherman/" name
info = info ? info : url
records[++record_count] = name "\t" info "\t" url "\t" stars
if (name && info && stars != "") {
records[++record_count] = name "\t" info "\t" "github.com/fisherman/" name "\t" stars
name = info = stars = ""
}
}