readline/example/readline-remote/readline-remote-server/server.go

27 lines
415 B
Go
Raw Permalink Normal View History

2016-03-13 13:32:48 +03:00
package main
import (
"fmt"
2022-12-12 16:55:00 +03:00
"git.internal/re/readline"
2016-03-13 13:32:48 +03:00
)
func main() {
cfg := &readline.Config{
Prompt: "readline-remote: ",
}
handleFunc := func(rl *readline.Instance) {
for {
line, err := rl.Readline()
if err != nil {
break
}
fmt.Fprintln(rl.Stdout(), "receive:"+line)
}
}
err := readline.ListenRemote("tcp", ":12344", cfg, handleFunc)
if err != nil {
println(err.Error())
}
}