diff --git a/main.go b/main.go new file mode 100644 index 0000000..25b51f6 --- /dev/null +++ b/main.go @@ -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") + } +}