-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommandStructs.go
61 lines (57 loc) · 1.38 KB
/
commandStructs.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
package main
import pokecache "github.com/chichigami/pokedex/internal"
func getCommands() map[string]cliCommand {
return map[string]cliCommand{
"help": {
name: "help",
description: "Display help message",
callback: commandHelp,
},
"exit": {
name: "exit",
description: "Exit the pokedex",
callback: commandExit,
},
"map": {
name: "map",
description: "Displays 20 locations. Can use again to get the next 20.",
callback: commandMap,
},
"mapb": {
name: "mapb",
description: "Opposite of map command. Will display previous 20 locations.",
callback: commandMapb,
},
"explore": {
name: "explore",
description: "Explore the given region",
callback: commandExplore,
},
"catch": {
name: "catch",
description: "Catch that pokemon",
callback: commandCatch,
},
"inspect": {
name: "inspect",
description: "Info about the pokemon",
callback: commandInspect,
},
"pokedex": {
name: "pokedex",
description: "Shows a list of all the Pokemon's you caught",
callback: commandPokedex,
},
}
}
type Config struct {
Next string
Previous string
cache *pokecache.Cache
caughtPokemons map[string]Pokemon
}
type cliCommand struct {
name string
description string
callback func(*Config, ...string) error
}