-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdevgo.go
More file actions
45 lines (38 loc) · 688 Bytes
/
devgo.go
File metadata and controls
45 lines (38 loc) · 688 Bytes
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
package main
import (
"github.com/nsf/termbox-go"
"github.com/thewinds/devgo/config"
"flag"
"log"
)
func main() {
flag.Parse()
if showVersion() {
return
}
conf := config.LoadConfig()
initTabEmojis(conf)
m := initMenu(conf)
err := termbox.Init()
if err != nil {
log.Fatalln(err)
}
termbox.SetInputMode(termbox.InputEsc)
m.init()
m.draw()
m.Run(conf.Mode)
termbox.Close()
}
func initMenu(conf *config.Config) *Menu {
var items []*MenuItem
for _, group := range conf.Groups {
for _, item := range group.Items {
items = append(items, &MenuItem{
title: item.Title,
cmd: item.Exec,
group: group.Name,
})
}
}
return &Menu{Items: items}
}