()
| 26 | ) |
| 27 | |
| 28 | func main() { |
| 29 | flag.Parse() |
| 30 | listPageCollector := colly.NewCollector() |
| 31 | listPageCollector.SetRequestTimeout(120 * time.Second) |
| 32 | |
| 33 | listPageCollector.OnRequest(func(r *colly.Request) { |
| 34 | fmt.Println("Visiting", r.URL) |
| 35 | }) |
| 36 | listPageCollector.OnHTML(listPageSelector, listPageHandler) |
| 37 | listPageCollector.OnResponse(func(r *colly.Response) { |
| 38 | if !*debugFlag { |
| 39 | return |
| 40 | } |
| 41 | err := os.WriteFile("listResponse.html", r.Body, 0644) |
| 42 | if err != nil { |
| 43 | fmt.Println(err) |
| 44 | } |
| 45 | }) |
| 46 | err := listPageCollector.Visit(listURI) |
| 47 | if err != nil { |
| 48 | fmt.Println(err) |
| 49 | } |
| 50 | |
| 51 | jsonData, err := json.Marshal(mapOfLibs) |
| 52 | if err != nil { |
| 53 | fmt.Println(err) |
| 54 | } |
| 55 | os.WriteFile(packagesFunctionsFiles, jsonData, 0644) |
| 56 | commands := [][]string{ |
| 57 | {"sed", "-i", "", "s/\\[\\]/{}/g", packagesFunctionsFiles}, |
| 58 | {"sed", "-i", "", "s/\\[/{/g", packagesFunctionsFiles}, |
| 59 | {"sed", "-i", "", "s/\\]/}/g", packagesFunctionsFiles}, |
| 60 | {"sed", "-i", "", "s/},/},\\n/g", packagesFunctionsFiles}, |
| 61 | } |
| 62 | executeCommands(commands) |
| 63 | |
| 64 | } |
| 65 | |
| 66 | func executeCommands(commands [][]string) { |
| 67 | for _, command := range commands { |
nothing calls this directly
no test coverage detected