Skip to content

Commit 70a6bff

Browse files
committed
Fix csv main
1 parent 3831ebe commit 70a6bff

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

main/calc-csv/main.go

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
11
package main
22

3+
import (
4+
"log"
5+
"os"
6+
7+
"github.com/XanSmarty/calc-apps/handlers"
8+
calc "github.com/XanSmarty/xan-calc-lib"
9+
)
10+
311
func main() {
4-
//logger := log.New(os.Stderr, ">>> ", 0)
5-
//logger := log.New(os.Stdout, "", log.LstdFlags|log.Lmicroseconds|log.Lshortfile)
6-
//handler := handlers.NewCSVHandler()
12+
logger := log.New(os.Stderr, ">>> ", 0)
13+
14+
handler := handlers.NewCSVHandler(logger, os.Stdin, os.Stdout, calculators)
15+
err := handler.Handle()
16+
if err != nil {
17+
logger.Fatal(err)
18+
}
19+
}
720

21+
var calculators = map[string]calc.Calculator{
22+
"+": &calc.Addition{},
23+
"-": &calc.Subtraction{},
24+
"/": &calc.Division{},
25+
"*": &calc.Multiplication{},
826
}

0 commit comments

Comments
 (0)