-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.go
55 lines (42 loc) · 1.24 KB
/
run.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
50
51
52
53
54
55
package tripanel
import (
"fmt"
"github.com/BellerophonMobile/commandtree"
"github.com/BellerophonMobile/gocui"
"github.com/BellerophonMobile/logberry"
)
var GUI *gocui.Gui
func Run(commands *commandtree.CommandTree) error {
defer logberry.Std.Stop()
err := installbuiltincommands(commands)
if err != nil {
return err
}
GUI, err = gocui.NewGui(gocui.OutputNormal)
if err != nil {
return err
}
defer GUI.Close()
GUI.Cursor = true
GUI.SetManagerFunc(layout)
err = keybindings()
if err != nil {
return err
}
err = GUI.MainLoop()
if err != nil && err != gocui.ErrQuit {
return err
}
return nil
}
func DisplayUsage() {
fmt.Fprintln(Views.App, "\033[34;7m USAGE \033[34m Application overview---\n")
fmt.Fprintln(Views.App, "Keyboard actions:")
fmt.Fprintln(Views.App, KeyboardUsage())
fmt.Fprintln(Views.App, "Command prompt actions:")
fmt.Fprintln(Views.App, Commands.Usage())
fmt.Fprintln(Views.App, "Command prompt may have doublequoted entries, with '\\\"', '\\\\', and '\\n' escapes")
fmt.Fprintln(Views.App, "Command prompt may have comments, beginning with a '#' outside doublequotes")
fmt.Fprintln(Views.App, "Help command can provide details for other commands given as parameters")
fmt.Fprint(Views.App, "\033[0m")
}