basic main

trunk
vilmibm 2023-06-11 18:58:01 -04:00
parent c9df23dd3c
commit 80fad75a59
1 changed files with 53 additions and 0 deletions

53
main.go 100644
View File

@ -0,0 +1,53 @@
package main
import (
"fmt"
"os"
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
"github.com/spf13/cobra"
)
const (
NormalMode = "normal"
FocusedMode = "focused"
SearchMode = "search"
ExMode = "ex"
)
type UI struct {
Mode string
App *tview.Application
}
func (ui *UI) handleInput(event *tcell.EventKey) *tcell.EventKey {
return nil
}
func newUI() *UI {
app := tview.NewApplication()
ui := UI{
Mode: NormalMode,
App: app,
}
app.SetInputCapture(ui.handleInput)
return &ui
}
func _main() error {
cmd := &cobra.Command{
Use: "porphyry",
RunE: func(cmd *cobra.Command, args []string) error {
return newUI().App.Run()
},
}
return cmd.Execute()
}
func main() {
if err := _main(); err != nil {
fmt.Fprintf(os.Stderr, err.Error()+"\n")
}
}