/
command.go
51 lines (46 loc) · 1.27 KB
/
command.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
package pull
import (
"github.com/swisscom/korp/docker_utils"
korpio "github.com/swisscom/korp/io"
"github.com/swisscom/korp/kustomize_utils"
"github.com/urfave/cli"
)
// BuildCommand - Build CLI application command
func BuildCommand() *cli.Command {
io := korpio.PullPushIoImpl{
OpenDockerClientFunc: docker_utils.OpenDockerClient,
LoadKustomizationFileFunc: kustomize_utils.LoadKustomizationFile,
}
action := Action{
Io: io,
}
return &cli.Command{
Name: "pull",
Aliases: []string{"p"},
Usage: "pull Docker images listed in the kustomization file to the local Docker registry",
Flags: []cli.Flag{
cli.StringFlag{
Name: "kustomization-path, k",
Usage: "path to the kustomization file (default: current dir)",
EnvVar: "KORP_PULL_KST_PATH",
Value: ".",
Required: false,
},
cli.StringFlag{
Name: "username, u",
Usage: "User name for accessing a registry which requires authentication",
EnvVar: "KORP_PULL_USERNAME",
Value: "",
Required: false,
},
cli.StringFlag{
Name: "password, p",
Usage: "Password for accessing a registry which requires authentication",
EnvVar: "KORP_PULL_PASSWORD",
Value: "",
Required: false,
},
},
Action: action.Pull,
}
}