23 lines
402 B
Go
23 lines
402 B
Go
package main
|
||
|
||
import (
|
||
"fmt"
|
||
"os"
|
||
|
||
"gitea.zaclys.com/bvaudour/readline"
|
||
"gitea.zaclys.net/bvaudour/go-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 d’entrée: %s\n", err)
|
||
}
|
||
}
|
||
}
|