From 6676b7d12b3bb381fdfacea816d50e9b86f9333d Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Mon, 3 Feb 2025 20:18:17 +0300 Subject: Fix: load json syscards, replace char and user --- main.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index 64f11d3..7766a60 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,9 @@ package main import ( + "flag" + "fmt" + "net/http" "unicode" "github.com/rivo/tview" @@ -24,6 +27,15 @@ func isASCII(s string) bool { } func main() { + apiPort := flag.Int("port", 0, "port to host api") + flag.Parse() + if apiPort != nil && *apiPort > 3000 { + // start api server + http.HandleFunc("POST /completion", completion) + http.ListenAndServe(fmt.Sprintf(":%d", *apiPort), nil) + // no tui + return + } pages.AddPage("main", flex, true, true) if err := app.SetRoot(pages, true).EnableMouse(true).EnablePaste(true).Run(); err != nil { -- cgit v1.2.3