-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
60 lines (56 loc) · 1.23 KB
/
types.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
package main
import (
"pokedexcli/commands"
"pokedexcli/internal"
)
type cliCommand struct {
name string
description string
callback func(conf *internal.ApiConfig, param string, pokedex *internal.Pokedex) error
}
var commandsMap = map[string]cliCommand{
"help": {
name: "help",
description: "Displays a help message",
callback: commands.Help,
},
"exit": {
name: "exit",
description: "Exit the Pokedex",
callback: commands.Exit,
},
"map": {
name: "exit",
description: "Exit the Pokedex",
callback: commands.Map,
},
"bmap": {
name: "exit",
description: "Exit the Pokedex",
callback: commands.Bmap,
},
"explore": {
name: "explore",
description: "Explores the Pokemon",
callback: commands.Explore,
},
"catch": {
name: "catch",
description: "Catches the Pokemon",
callback: commands.Catch,
},
"inspect": {
name: "inspect",
description: "Inspects your pokemon",
callback: commands.Inspect,
},
"pokedex": {
name: "pokedex",
description: "Lists all your pokemons",
callback: commands.Pokedex,
},
}
func getCommand(command string) (cliCommand, bool) {
res, ok := commandsMap[command]
return res, ok
}