2
0
mirror of https://github.com/edouardparis/lntop synced 2024-11-16 00:12:44 +00:00
lntop/ui/views/help.go

40 lines
703 B
Go
Raw Normal View History

2019-04-01 16:30:25 +00:00
package views
import (
"fmt"
"github.com/jroimartin/gocui"
2019-04-02 08:14:39 +00:00
"github.com/edouardparis/lntop/ui/color"
2019-04-01 16:30:25 +00:00
)
const (
HELP = "help"
)
2019-04-02 08:14:39 +00:00
type Help struct {
}
func (h Help) Name() string {
return HELP
}
func (h Help) Set(g *gocui.Gui, x0, y0, x1, y1 int) error {
2019-04-01 16:30:25 +00:00
v, err := g.SetView(HELP, x0-1, y0, x1, y1)
if err != nil {
if err != gocui.ErrUnknownView {
return err
}
}
v.Frame = false
2019-04-02 08:14:39 +00:00
fmt.Fprintln(v, "lntop 0.0.1 - (C) 2019 Edouard Paris")
fmt.Fprintln(v, "Released under the MIT License")
fmt.Fprintln(v, "")
fmt.Fprintln(v, fmt.Sprintf("%5s %s",
color.Cyan("F1 h:"), "show this help screen"))
2019-04-01 16:30:25 +00:00
_, err = g.SetCurrentView(HELP)
return err
}
2019-04-02 08:14:39 +00:00
func NewHelp() *Help { return &Help{} }