-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
50 lines (39 loc) · 884 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
46
47
48
49
package main
import (
"fmt"; "os"
"github.com/nsf/termbox-go"
"where/utils"
)
func main() {
// Termbox init
err := termbox.Init()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
defer termbox.Close()
// Global definitions
glob := &utils.Global {
X: 3,
Text: "",
Select_mode: false,
}
entry_points := []string { "/home" }
// Last configurations
termbox.SetOutputMode(termbox.Output256)
// Main loop
for {
termbox.Clear(termbox.ColorDefault, termbox.ColorDefault)
// Finding matching subdirs
if !glob.Select_mode {
glob.Matches = utils.Find_subdirs(glob, entry_points, glob.Text, 5)
}
// Render function
utils.Matches_render(glob, false)
utils.Text_render(glob)
termbox.Flush()
// Input management
event := termbox.PollEvent()
utils.Input_mgr(glob, event)
}
}