summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-02-03 20:18:17 +0300
committerGrail Finder <wohilas@gmail.com>2025-02-03 20:18:17 +0300
commit6676b7d12b3bb381fdfacea816d50e9b86f9333d (patch)
treef75851e867dc3275f1c5f977dd20b81e812f2085 /main.go
parenteb53b13381b6f86e8b0584b8bdc980414dbf92df (diff)
Fix: load json syscards, replace char and user
Diffstat (limited to 'main.go')
-rw-r--r--main.go12
1 files changed, 12 insertions, 0 deletions
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 {