-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommand.go
63 lines (59 loc) · 1.44 KB
/
command.go
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package main
import (
"github.com/oliverwhite19/pokedexcli/internal/pokeapi"
)
type cliCommand struct {
name string
description string
callback func(*memory, ...string) error
}
type memory struct {
previousLocations *string
nextLocations *string
pokeClient pokeapi.Client
capturedPokemon map[string]pokeapi.ResponsePokemon
}
func getCommands() map[string]cliCommand {
return map[string]cliCommand{
"help": {
name: "help",
description: "Displays a help message",
callback: commandHelp,
},
"map": {
name: "map",
description: "Displays the next 20 map locations",
callback: commandMap,
},
"mapb": {
name: "mapb",
description: "Displays the previous 20 map locations",
callback: commandMapB,
},
"explore": {
name: "explore <location_name>",
description: "Explores a location",
callback: commandExplore,
},
"catch": {
name: "catch <pokemon_name>",
description: "Attempts to catch a pokemon",
callback: commandCatch,
},
"inspect": {
name: "inspect <pokemon_name>",
description: "Lists the details of an already caught pokemon",
callback: commandInspect,
},
"pokedex": {
name: "pokedex",
description: "Lists all the currently caught pokemon",
callback: commandPokedex,
},
"exit": {
name: "exit",
description: "Exit the Pokedex",
callback: commandExit,
},
}
}