-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
38 lines (35 loc) · 956 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
package main
import (
"log"
"github.com/abu-lang/abusim/abusim/args"
"github.com/abu-lang/abusim/abusim/command"
"github.com/abu-lang/abusim/abusim/config"
"github.com/abu-lang/abusim/abusim/docker"
)
func main() {
// I get the arguments from the command line...
argsConfig := args.ParseArgs()
// ... I parse the configuration file...
conf, err := config.Parse(argsConfig.ConfigFile)
if err != nil {
log.Fatalf("Error parsing config file: %v", err)
}
// ... I connect to the docker daemon...
dcli, err := docker.New()
if err != nil {
log.Fatalf("Error creating docker client: %v", err)
}
// ... and I execute the correct subcommand
switch argsConfig.SubCommand {
case args.SUBCOMMAND_UP:
command.Up(argsConfig, conf, dcli)
case args.SUBCOMMAND_DOWN:
command.Down(argsConfig, conf, dcli)
case args.SUBCOMMAND_LOGS:
if argsConfig.FollowLogs {
command.LogsFollow(conf, dcli)
} else {
command.Logs(conf, dcli)
}
}
}