-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
45 lines (41 loc) · 860 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
39
40
41
42
43
44
45
package main
import (
"flag"
"path/filepath"
// pty "zen108.com/lspvi/pkg/pty"
mainui "zen108.com/lspvi/pkg/ui"
"zen108.com/lspvi/pkg/ui/common"
web "zen108.com/lspvi/pkg/ui/xterm"
)
type arg struct {
count int
ws string
}
func main() {
gui := flag.Bool("gui", false, "guimain")
ws := flag.String("ws", "", "websocket address")
tty := flag.Bool("tty", false, "guimain")
grep := flag.Bool("grep", false, "grep")
help := flag.Bool("help", false, "help")
root := flag.String("root", "", "root-dir")
file := flag.String("file", "", "source file")
flag.Parse()
var arg = &common.Arguments{
Root: *root,
File: *file,
Tty: *tty,
Ws: *ws,
Grep: *grep,
Help: *help,
}
if *gui {
dir := *root
if dir == "" {
dir, _ = filepath.Abs(".")
}
web.SetPjrRoot(dir)
web.StartWebUI(*arg, nil)
return
}
mainui.MainUI(arg)
}