blob: 5f7bfe3c95d114d3930b5884c96e88f66a547aae (
plain)
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
|
package main
import (
"os"
_ "github.com/containers/libpod/cmd/podman/containers"
_ "github.com/containers/libpod/cmd/podman/healthcheck"
_ "github.com/containers/libpod/cmd/podman/images"
_ "github.com/containers/libpod/cmd/podman/networks"
_ "github.com/containers/libpod/cmd/podman/pods"
"github.com/containers/libpod/cmd/podman/registry"
_ "github.com/containers/libpod/cmd/podman/system"
_ "github.com/containers/libpod/cmd/podman/volumes"
"github.com/containers/storage/pkg/reexec"
)
func init() {
// This is the bootstrap configuration, if user gives
// CLI flags parts of this configuration may be overwritten
registry.PodmanOptions = registry.NewPodmanConfig()
}
func main() {
if reexec.Init() {
// We were invoked with a different argv[0] indicating that we
// had a specific job to do as a subprocess, and it's done.
return
}
for _, c := range registry.Commands {
for _, m := range c.Mode {
if registry.PodmanOptions.EngineMode == m {
parent := rootCmd
if c.Parent != nil {
parent = c.Parent
}
parent.AddCommand(c.Command)
// - templates need to be set here, as PersistentPreRunE() is
// not called when --help is used.
// - rootCmd uses cobra default template not ours
c.Command.SetHelpTemplate(helpTemplate)
c.Command.SetUsageTemplate(usageTemplate)
}
}
}
Execute()
os.Exit(0)
}
|