24 lines
422 B
Go
24 lines
422 B
Go
package main
|
||
|
||
import (
|
||
"fmt"
|
||
"os"
|
||
|
||
"gitea.zaclys.com/bvaudour/greadline"
|
||
"gitea.zaclys.net/bvaudour/go-calc/calc/cli"
|
||
)
|
||
|
||
func main() {
|
||
calc, rl := cli.New(), greadline.New()
|
||
defer rl.Close()
|
||
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)
|
||
}
|
||
}
|
||
}
|