mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00

* Enable running podman V2 rootless * Fixed cobra.PersistentPreRunE usage in all the commands * Leveraged cobra.PersistentPreRunE/cobra.PersistentPostRunE to manage: * rootless * trace (--trace) * profiling (--cpu-profile) * initializing the registry copies of Image/Container engines * Help and Usage templates autoset for all sub-commands Signed-off-by: Jhon Honce <jhonce@redhat.com>
41 lines
935 B
Go
41 lines
935 B
Go
package containers
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/containers/common/pkg/config"
|
|
"github.com/containers/libpod/cmd/podmanV2/registry"
|
|
"github.com/containers/libpod/pkg/domain/entities"
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
// Command: podman _container_
|
|
containerCmd = &cobra.Command{
|
|
Use: "container",
|
|
Short: "Manage containers",
|
|
Long: "Manage containers",
|
|
TraverseChildren: true,
|
|
RunE: registry.SubCommandExists,
|
|
}
|
|
|
|
defaultContainerConfig = getDefaultContainerConfig()
|
|
)
|
|
|
|
func init() {
|
|
registry.Commands = append(registry.Commands, registry.CliCommand{
|
|
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
|
Command: containerCmd,
|
|
})
|
|
}
|
|
|
|
func getDefaultContainerConfig() *config.Config {
|
|
defaultContainerConfig, err := config.Default()
|
|
if err != nil {
|
|
logrus.Error(err)
|
|
os.Exit(1)
|
|
}
|
|
return defaultContainerConfig
|
|
}
|