Skip to content

Commit

Permalink
refactor: remove back and exit options from custom
Browse files Browse the repository at this point in the history
  • Loading branch information
nightah committed Jul 22, 2022
1 parent 1675805 commit dd9e1d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 30 deletions.
30 changes: 10 additions & 20 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,14 @@ func full(servers []string) {
}

func custom(servers []string) {
selection:
file := ""
result := []string{}
prompt := &survey.MultiSelect{
Message: "Select CDN(s):",
Options: []string{"Back", "ArenaNet", "Blizzard", "Battle State Games", "City of Heroes", "Daybreak Games",
Options: []string{"ArenaNet", "Blizzard", "Battle State Games", "City of Heroes", "Daybreak Games",
"Epic Games", "Frontier", "Neverwinter", "Nexus Mods", "Nintendo", "Origin", "Path of Exile",
"RenegadeX", "Riot Games", "Rockstar Games", "Sony", "SQUARE ENIX", "Steam", "The Elder Scrolls Online",
"UPlay", "Warframe", "WARGAMING", "Windows Updates", "Xbox Live", "Exit"},
"UPlay", "Warframe", "WARGAMING", "Windows Updates", "Xbox Live"},
PageSize: 20,
}

Expand All @@ -87,24 +86,15 @@ selection:
return
}

switch {
case isStringInSlice("Back", result):
main()
case isStringInSlice("Exit", result):
os.Exit(0)
default:
for _, cdn := range result {
for _, cdns := range CDNs {
if cdn == cdns.Name {
file = cdns.File
hostnames := parseCDN(cdn, file)
lookupHostnames("", hostnames, 1, servers)
} else {
continue
}
for _, cdn := range result {
for _, cdns := range CDNs {
if cdn == cdns.Name {
file = cdns.File
hostnames := parseCDN(cdn, file)
lookupHostnames("", hostnames, 1, servers)
} else {
continue
}
}
}

goto selection
}
10 changes: 0 additions & 10 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,16 +232,6 @@ func isLookupInSliceEqual(a []Lookup, multihost bool) []Lookup {
return l
}

func isStringInSlice(needle string, haystack []string) (inSlice bool) {
for _, b := range haystack {
if b == needle {
return true
}
}

return false
}

func URLToLines(url string) ([]string, error) {
resp, err := http.Get(url)
if err != nil {
Expand Down

0 comments on commit dd9e1d0

Please sign in to comment.