go-calc/main.go

24 lines
422 B
Go
Raw Normal View History

2024-02-21 10:42:56 +00:00
package main
import (
"fmt"
"os"
2024-03-02 13:50:01 +00:00
"gitea.zaclys.com/bvaudour/greadline"
2024-02-25 17:29:03 +00:00
"gitea.zaclys.net/bvaudour/go-calc/calc/cli"
2024-02-21 10:42:56 +00:00
)
func main() {
2024-03-02 13:50:01 +00:00
calc, rl := cli.New(), greadline.New()
defer rl.Close()
2024-02-21 10:42:56 +00:00
for {
result := rl.Prompt("> ")
if args, ok := result.Ok(); ok {
calc.ExecAll(args)
} else if err, ok := result.Err(); ok {
fmt.Println(result)
fmt.Fprintf(os.Stderr, "Erreur dentrée: %s\n", err)
}
}
}