-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
45 lines (36 loc) · 882 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"
"fmt"
"github.com/bannzai/itree/pkg/parser"
"github.com/bannzai/itree/pkg/ui"
"github.com/rivo/tview"
)
var (
path = flag.String("path", "./", "specified start path. default is ./")
help = flag.Bool("help", false, "displayed help message for itree")
)
func main() {
flag.Parse()
if *help {
fmt.Printf(`itree displayed file system tree and command interactively about file system.
Usage:
itree [options]
The options are:
--path=$PATH specified start path. default is ./
--help displayed help message for itree
`,
)
return
}
size, err := parser.ParseSize()
if err != nil {
panic(err)
}
application := tview.NewApplication()
ui.SharedConfig.Application = application
ui.SharedConfig.RootPath = *path
if err := application.SetRoot(ui.NewWindow(size.Width, size.Height), true).Run(); err != nil {
panic(err)
}
}