-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
47 lines (41 loc) · 892 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"log"
"os"
"time"
"leistungsnachweis-graphiker/solver"
"github.com/urfave/cli"
)
func main() {
app := cli.NewApp()
app.Name = "Pathfinder"
app.Usage = "A solver for the travelling salesman problem"
app.HideVersion = true
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "algorithm",
Usage: "name of the algorithm to use",
},
cli.StringFlag{
Name: "problem",
Usage: "path to the problem-file to be solved",
},
cli.StringFlag{
Name: "bind",
Usage: "address to listen for websocket-connections",
},
}
app.Action = startCli
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}
func startCli(c *cli.Context) {
algorithm := c.String("algorithm")
problem := c.String("problem")
bind := c.String("bind")
cliController := solver.NewCli(algorithm, problem, bind)
time.Sleep(time.Second * 3)
cliController.Start()
}