2024-02-21 10:42:56 +00:00
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
|
|
|
|
|
"gitea.zaclys.com/bvaudour/readline"
|
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() {
|
|
|
|
|
calc, rl := cli.New(), readline.New()
|
|
|
|
|
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 d’entrée: %s\n", err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|