This commit is contained in:
2025-03-10 22:20:51 +02:00
parent 0148583f5b
commit cd8c2ee09e
6 changed files with 156 additions and 12 deletions

14
main.go
View File

@@ -26,7 +26,7 @@ var commands map[string]cliCommand
func main() {
pokeClient := pokeapi.NewClient(5 * time.Second)
pokeClient := pokeapi.NewClient(5*time.Second, time.Minute*5)
cfg := &config{
pokeapiClient: pokeClient,
}
@@ -84,15 +84,9 @@ func commandExit(*config) error {
}
func cleanInput(text string) []string {
// trim input string
text = strings.TrimSpace(text)
// convert to lowercase
text = strings.ToLower(text)
// replace all double spaces into single space
text = strings.Replace(text, " ", " ", -1)
// split by space
separated := strings.Split(text, " ")
return separated
output := strings.ToLower(text)
words := strings.Fields(output)
return words
}
func printHelpMessage(*config) error {