Skip to content

Commit

Permalink
Merge pull request #4 from joshuabeny1999/update-typ
Browse files Browse the repository at this point in the history
Add information if package is an security upgrade
  • Loading branch information
joshuabeny1999 authored May 26, 2020
2 parents 2cf7d7d + f33f806 commit f12af67
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/updatecheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func updatecheck() {
}
packages := strings.Split(string(out), "\n")
packCount := 0
packSecCount := 0
message := "<b>" + serverName + "</b>\n"
packageList := ""
for _, pack := range packages {
Expand All @@ -51,7 +52,12 @@ func updatecheck() {
continue
default:
packSplitted := strings.Split(pack, "/")
packageList += "- " + packSplitted[0] + "\n"
if strings.Contains(pack, "security") {
packSecCount++
packageList += "- <b>" + packSplitted[0] + " [security]</b>\n"
} else {
packageList += "- " + packSplitted[0] + "\n"
}
packCount++
}
}
Expand All @@ -63,7 +69,7 @@ func updatecheck() {
os.Exit(1)
}

message += "<i>" + strconv.Itoa(packCount) + " packages can be updated:</i>\n\n<pre>" + packageList + "</pre>"
message += "<i>" + strconv.Itoa(packCount) + " packages can be updated \n(" + strconv.Itoa(packSecCount) + " are security updates):</i>\n\n" + packageList
msg := tgbotapi.NewMessage(chatUserID, message)
msg.ParseMode = "HTML"

Expand Down

0 comments on commit f12af67

Please sign in to comment.