-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
38 lines (31 loc) · 830 Bytes
/
main.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
package main
import (
"flag"
aw "github.com/deanishe/awgo"
"github.com/skar404/alfred-translate/commands"
"github.com/skar404/alfred-translate/global"
"log"
)
func init() {
global.WF = aw.New()
flag.StringVar(&global.Flag.Command, "command", "", "command type")
flag.StringVar(&global.Flag.Value, "value", "", "")
flag.StringVar(&global.Flag.SetKey, "set", "", "save a value")
flag.StringVar(&global.Flag.GetKey, "get", "", "enter a new value")
}
func run() {
flag.Parse()
log.Printf("flag flag=%+v args=%+v", global.Flag, flag.Args())
command := global.Flag.Command
switch command {
case global.Setting:
commands.Setting()
case global.Translate:
commands.Translate()
}
global.WF.WarnEmpty("No Matching Items", "Try a different query?")
global.WF.SendFeedback()
}
func main() {
global.WF.Run(run)
}