-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreleaseNote.go
More file actions
46 lines (40 loc) · 1.05 KB
/
Copy pathreleaseNote.go
File metadata and controls
46 lines (40 loc) · 1.05 KB
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
package main
import (
"bufio"
"fmt"
"gonob/translations"
"net/http"
"strings"
scolor "github.com/SnowsSky/scolor/pkg"
)
func Release_note() {
url := "https://raw.githubusercontent.com/SnowsSky/gonob/main/patchnotes.md"
resp, err := http.Get(url)
if err != nil {
scolor.BoldRed.DisplayText("==> ")
scolor.BoldWhite.DisplayText(translations.Translate("error_string") + " : " + translations.Translate("unable_to_get_releases_notes") + "\n")
}
defer resp.Body.Close()
scanner := bufio.NewScanner(resp.Body)
var result strings.Builder
capture := false
scolor.BoldWhite.DisplayText("- gonob " + version + "\n")
for scanner.Scan() {
line := scanner.Text()
if strings.HasPrefix(line, "- gonob") {
if strings.TrimSpace(strings.TrimPrefix(line, "- gonob")) == version {
capture = true
continue
}
if capture {
break
}
}
if capture {
result.WriteString(line + "\n")
}
}
content := result.String()
fmt.Println(content)
scolor.BoldWhite.DisplayText("https://raw.githubusercontent.com/SnowsSky/gonob/main/patchnotes.md \n")
}