package main import ( "bufio" "flag" "fmt" "io/ioutil" "os" picol "github.com/dragonheim/gagent/pkg/picol" ) var fname = flag.String("f", "", "file name") func main() { flag.Parse() interp := picol.NewInterpreter() interp.RegisterCoreCommands() buf, err := ioutil.ReadFile(*fname) if err == nil { result, err := interp.Eval(string(buf)) if err != nil { fmt.Println("ERRROR", result, err) } } else { for { fmt.Print("picol> ") scanner := bufio.NewReader(os.Stdin) clibuf, _ := scanner.ReadString('\n') result, err := interp.Eval(clibuf[:len(clibuf)-1]) if len(result) != 0 { fmt.Println("ERRROR", result, err) } } } }