package main import ( "fmt" "flag" "log" "os" "strconv" "FRMS/internal/pkg/tui" ) type TUI interface { Start() } func NewTUI(ip string, port int, ch chan error) TUI { return tui.NewTUI(ip, port, ch) } func main() { var port int var err error flag.Usage = func() { w := flag.CommandLine.Output() fmt.Fprintf(w,"Usage: %s port \n", os.Args[0]) } flag.Parse() if flag.NArg() != 1 { flag.Usage() os.Exit(1) } args := flag.Args() if port, err = strconv.Atoi(args[0]); port < 1024 || port > 65536 { flag.Usage() log.Fatal("Port must be between [1023,65535]") } else if err != nil { log.Fatal(err) } ch := make(chan error) t := NewTUI("192.1.168.136",port,ch) go t.Start() err = <-ch if err != nil { log.Fatal(err) } }