go-calc/main.go

23 lines
399 B
Go
Raw Normal View History

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