-
Notifications
You must be signed in to change notification settings - Fork 0
/
registryManager.go
68 lines (49 loc) · 1.08 KB
/
registryManager.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package main
import (
"flag"
"fmt"
"log"
"manager/config"
"manager/docker"
"manager/subcommands"
)
func main() {
//defaultConf := "/etc/docker/daemon.json"
var Config *config.Conf
conf := flag.String("c", "", "manager config file")
flag.Parse()
var err error
// 命令行指定的配置文件优先,没有指定尝试读取默认配置,
// 默认配置不存在则要求输入docker配置文件的路径,并保存在默认配置中
if *conf != "" {
Config, err = config.New(*conf)
}
if err != nil || *conf == "" {
Config, err = config.NewDefault()
}
if err != nil {
Config, err = config.Create()
}
/*
if *conf == "" {
Config, err = config.NewDefault()
} else {
Config, err = config.New(*conf)
}
*/
if err != nil {
log.Fatalln(err)
}
path := Config.ReadPath()
dockerConf, err := docker.New(path)
if err != nil {
log.Fatalln(err)
}
fmt.Println(dockerConf)
fmt.Printf("All commands are: %s\n", subcommands.AllCmds)
err = subcommands.CmdScanner(dockerConf)
if err != nil {
log.Fatalln(err)
}
//subcommands.List(dockerConf)
}