ucl/cmd/cmsh/main.go

31 lines
444 B
Go
Raw Normal View History

2024-04-10 10:45:58 +00:00
package main
import (
"context"
"github.com/chzyer/readline"
"github.com/lmika/cmdlang-proto/cmdlang"
"log"
)
func main() {
rl, err := readline.New("> ")
if err != nil {
panic(err)
}
defer rl.Close()
inst := cmdlang.New()
ctx := context.Background()
for {
line, err := rl.Readline()
if err != nil { // io.EOF
break
}
if err := inst.EvalAndDisplay(ctx, line); err != nil {
2024-04-10 10:45:58 +00:00
log.Printf("%T: %v", err, err)
}
}
}