mirror of
https://github.com/wahyd4/cash-code-test.git
synced 2026-08-08 21:08:12 +10:00
31 lines
530 B
Go
31 lines
530 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/wahyd4/cash/domains"
|
|
"github.com/wahyd4/cash/workflow"
|
|
)
|
|
|
|
func main() {
|
|
if len(os.Args) != 2 {
|
|
logrus.Fatal("Please run the cash application by: go run main.go <input.txt>")
|
|
}
|
|
|
|
filePathParam := os.Args[1]
|
|
|
|
bank := domains.InitBank()
|
|
app := workflow.APP{Bank: bank}
|
|
|
|
commands, err := app.Load(filePathParam)
|
|
|
|
if err != nil {
|
|
logrus.Panic("fail to load input" + err.Error())
|
|
}
|
|
|
|
if err := app.Run(commands); err != nil {
|
|
logrus.Error(err)
|
|
}
|
|
}
|