-
Notifications
You must be signed in to change notification settings - Fork 4
/
targets.go
70 lines (62 loc) · 881 Bytes
/
targets.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
64
65
66
67
68
69
70
package main
type Target struct {
Name string
Key rune
Id string
}
var availableTargets = []Target{
{
Name: "google",
Key: 'g',
Id: "#t85",
},
{
Name: "bing",
Key: 'b',
Id: "#t101",
},
{
Name: "tineye",
Key: 't',
Id: "#t11",
},
{
Name: "reddit",
Key: 'r',
Id: "#t97",
},
{
Name: "yandex",
Key: 'y',
Id: "#t72",
},
{
Name: "baidu",
Key: 'a',
Id: "#t74",
},
{
Name: "so",
Key: 's',
Id: "#t109",
},
{
Name: "sogou",
Key: 'u',
Id: "#t110",
},
}
func getKeyToNameTargets(targets []Target) map[rune]string {
m := make(map[rune]string)
for _, target := range targets {
m[target.Key] = target.Name
}
return m
}
func getNameToIdTargets(targets []Target) map[string]string {
m := make(map[string]string)
for _, target := range targets {
m[target.Name] = target.Id
}
return m
}