MCPcopy Create free account
hub / github.com/ahmedakef/goshell / main

Function main

scripts/fetcher.go:28–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26)
27
28func 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
66func executeCommands(commands [][]string) {
67 for _, command := range commands {

Callers

nothing calls this directly

Calls 2

executeCommandsFunction · 0.85
VisitMethod · 0.80

Tested by

no test coverage detected