mirror of https://github.com/containers/podman.git
[Techinal Debt] Cleanup ABI vs. Tunnel CLI commands
[NO TESTS NEEDED] This commit cleans up two issues: * Most commands support all EngineModes so default to that. Let outlayers declare their intent. * Use cobra.Annotations to set supported EngineMode. This simplies instantiating commands as there is now one method to communicate a commands requirements rather than two. * Combined aliased commands into one file * Fixed aliased commands where Args field did not match * Updated examples in README.md for writing commands * Remove redundant flag DisableFlagsInUseLine in cobra.Command initialization. Signed-off-by: Jhon Honce <jhonce@redhat.com>
This commit is contained in:
parent
4f4a440afd
commit
33944cefe7
|
@ -40,9 +40,6 @@ var (
|
|||
func init() {
|
||||
// Subscribe command to podman
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
// _podman manifest_ will support both ABIMode and TunnelMode
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
// The definition for this command
|
||||
Command: manifestCmd,
|
||||
})
|
||||
}
|
||||
|
@ -83,9 +80,6 @@ var (
|
|||
func init() {
|
||||
// Subscribe inspect sub command to manifest command
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
// _podman manifest inspect_ will support both ABIMode and TunnelMode
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
// The definition for this command
|
||||
Command: inspectCmd,
|
||||
// The parent command to proceed this command on the CLI
|
||||
Parent: manifestCmd,
|
||||
|
|
|
@ -21,6 +21,7 @@ var (
|
|||
or similar units that create new containers in order to run the updated images.
|
||||
Please refer to the podman-auto-update(1) man page for details.`
|
||||
autoUpdateCommand = &cobra.Command{
|
||||
Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
|
||||
Use: "auto-update [options]",
|
||||
Short: "Auto update containers according to their auto-update policy",
|
||||
Long: autoUpdateDescription,
|
||||
|
@ -33,7 +34,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode},
|
||||
Command: autoUpdateCommand,
|
||||
})
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
commonComp "github.com/containers/common/pkg/completion"
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -39,7 +38,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: completionCmd,
|
||||
})
|
||||
flags := completionCmd.Flags()
|
||||
|
|
|
@ -55,14 +55,12 @@ func attachFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: attachCommand,
|
||||
})
|
||||
attachFlags(attachCommand)
|
||||
validate.AddLatestFlag(attachCommand, &attachOpts.Latest)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerAttachCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -42,7 +42,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: checkpointCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -21,10 +21,11 @@ var (
|
|||
Cleans up mount points and network stacks on one or more containers from the host. The container name or ID can be used. This command is used internally when running containers, but can also be used if container cleanup has failed when a container exits.
|
||||
`
|
||||
cleanupCommand = &cobra.Command{
|
||||
Use: "cleanup [options] CONTAINER [CONTAINER...]",
|
||||
Short: "Cleanup network and mountpoints of one or more containers",
|
||||
Long: cleanupDescription,
|
||||
RunE: cleanup,
|
||||
Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
|
||||
Use: "cleanup [options] CONTAINER [CONTAINER...]",
|
||||
Short: "Cleanup network and mountpoints of one or more containers",
|
||||
Long: cleanupDescription,
|
||||
RunE: cleanup,
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
|
||||
},
|
||||
|
@ -41,7 +42,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode},
|
||||
Parent: containerCmd,
|
||||
Command: cleanupCommand,
|
||||
})
|
||||
|
|
|
@ -82,13 +82,11 @@ func commitFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: commitCommand,
|
||||
})
|
||||
commitFlags(commitCommand)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerCommitCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -3,7 +3,6 @@ package containers
|
|||
import (
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/cmd/podman/validate"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/containers/podman/v3/pkg/util"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -26,7 +25,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerCmd,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -62,13 +62,11 @@ func cpFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: cpCommand,
|
||||
})
|
||||
cpFlags(cpCommand)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerCpCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -39,7 +39,7 @@ var (
|
|||
}
|
||||
|
||||
containerCreateCommand = &cobra.Command{
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
Args: createCommand.Args,
|
||||
Use: createCommand.Use,
|
||||
Short: createCommand.Short,
|
||||
Long: createCommand.Long,
|
||||
|
@ -72,13 +72,11 @@ func createFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: createCommand,
|
||||
})
|
||||
createFlags(createCommand)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerCreateCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -27,7 +27,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: diffCmd,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -21,24 +21,22 @@ var (
|
|||
execDescription = `Execute the specified command inside a running container.
|
||||
`
|
||||
execCommand = &cobra.Command{
|
||||
Use: "exec [options] CONTAINER [COMMAND [ARG...]]",
|
||||
Short: "Run a process in a running container",
|
||||
Long: execDescription,
|
||||
RunE: exec,
|
||||
DisableFlagsInUseLine: true,
|
||||
ValidArgsFunction: common.AutocompleteExecCommand,
|
||||
Use: "exec [options] CONTAINER [COMMAND [ARG...]]",
|
||||
Short: "Run a process in a running container",
|
||||
Long: execDescription,
|
||||
RunE: exec,
|
||||
ValidArgsFunction: common.AutocompleteExecCommand,
|
||||
Example: `podman exec -it ctrID ls
|
||||
podman exec -it -w /tmp myCtr pwd
|
||||
podman exec --user root ctrID ls`,
|
||||
}
|
||||
|
||||
containerExecCommand = &cobra.Command{
|
||||
Use: execCommand.Use,
|
||||
Short: execCommand.Short,
|
||||
Long: execCommand.Long,
|
||||
RunE: execCommand.RunE,
|
||||
DisableFlagsInUseLine: true,
|
||||
ValidArgsFunction: execCommand.ValidArgsFunction,
|
||||
Use: execCommand.Use,
|
||||
Short: execCommand.Short,
|
||||
Long: execCommand.Long,
|
||||
RunE: execCommand.RunE,
|
||||
ValidArgsFunction: execCommand.ValidArgsFunction,
|
||||
Example: `podman container exec -it ctrID ls
|
||||
podman container exec -it -w /tmp myCtr pwd
|
||||
podman container exec --user root ctrID ls`,
|
||||
|
@ -92,14 +90,12 @@ func execFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: execCommand,
|
||||
})
|
||||
execFlags(execCommand)
|
||||
validate.AddLatestFlag(execCommand, &execOpts.Latest)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerExecCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -18,16 +18,14 @@ var (
|
|||
Long: containerExistsDescription,
|
||||
Example: `podman container exists --external containerID
|
||||
podman container exists myctr || podman run --name myctr [etc...]`,
|
||||
RunE: exists,
|
||||
Args: cobra.ExactArgs(1),
|
||||
DisableFlagsInUseLine: true,
|
||||
ValidArgsFunction: common.AutocompleteContainers,
|
||||
RunE: exists,
|
||||
Args: cobra.ExactArgs(1),
|
||||
ValidArgsFunction: common.AutocompleteContainers,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: existsCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -55,13 +55,11 @@ func exportFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: exportCommand,
|
||||
})
|
||||
exportFlags(exportCommand)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerExportCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -52,7 +52,6 @@ func initFlags(flags *pflag.FlagSet) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: initCommand,
|
||||
})
|
||||
flags := initCommand.Flags()
|
||||
|
@ -60,7 +59,6 @@ func init() {
|
|||
validate.AddLatestFlag(initCommand, &initOptions.Latest)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Parent: containerCmd,
|
||||
Command: containerInitCommand,
|
||||
})
|
||||
|
|
|
@ -26,7 +26,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: inspectCmd,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -67,14 +67,12 @@ func killFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: killCommand,
|
||||
})
|
||||
killFlags(killCommand)
|
||||
validate.AddLatestFlag(killCommand, &killOptions.Latest)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerKillCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"github.com/containers/common/pkg/completion"
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/cmd/podman/validate"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -26,7 +25,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: listCmd,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -77,7 +77,6 @@ func init() {
|
|||
|
||||
// logs
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: logsCommand,
|
||||
})
|
||||
logsFlags(logsCommand)
|
||||
|
@ -85,7 +84,6 @@ func init() {
|
|||
|
||||
// container logs
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerLogsCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -25,6 +25,11 @@ var (
|
|||
`
|
||||
|
||||
mountCommand = &cobra.Command{
|
||||
Annotations: map[string]string{
|
||||
registry.UnshareNSRequired: "",
|
||||
registry.ParentNSRequired: "",
|
||||
registry.EngineMode: registry.ABIMode,
|
||||
},
|
||||
Use: "mount [options] [CONTAINER...]",
|
||||
Short: "Mount a working container's root filesystem",
|
||||
Long: mountDescription,
|
||||
|
@ -32,20 +37,16 @@ var (
|
|||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
return validate.CheckAllLatestAndCIDFile(cmd, args, true, false)
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
registry.UnshareNSRequired: "",
|
||||
registry.ParentNSRequired: "",
|
||||
},
|
||||
ValidArgsFunction: common.AutocompleteContainers,
|
||||
}
|
||||
|
||||
containerMountCommand = &cobra.Command{
|
||||
Annotations: mountCommand.Annotations,
|
||||
Use: mountCommand.Use,
|
||||
Short: mountCommand.Short,
|
||||
Long: mountCommand.Long,
|
||||
RunE: mountCommand.RunE,
|
||||
Args: mountCommand.Args,
|
||||
Annotations: mountCommand.Annotations,
|
||||
ValidArgsFunction: mountCommand.ValidArgsFunction,
|
||||
}
|
||||
)
|
||||
|
@ -68,14 +69,12 @@ func mountFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode},
|
||||
Command: mountCommand,
|
||||
})
|
||||
mountFlags(mountCommand)
|
||||
validate.AddLatestFlag(mountCommand, &mountOpts.Latest)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode},
|
||||
Command: containerMountCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -48,14 +48,12 @@ func pauseFlags(flags *pflag.FlagSet) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: pauseCommand,
|
||||
})
|
||||
flags := pauseCommand.Flags()
|
||||
pauseFlags(flags)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerPauseCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -56,14 +56,12 @@ func portFlags(flags *pflag.FlagSet) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: portCommand,
|
||||
})
|
||||
portFlags(portCommand.Flags())
|
||||
validate.AddLatestFlag(portCommand, &portOpts.Latest)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerPortCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -35,7 +35,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: pruneCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -60,14 +60,12 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: psCommand,
|
||||
})
|
||||
listFlagSet(psCommand)
|
||||
validate.AddLatestFlag(psCommand, &listOpts.Latest)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: psContainerCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -33,12 +33,10 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: renameCommand,
|
||||
})
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerRenameCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -39,6 +39,7 @@ var (
|
|||
Short: restartCommand.Short,
|
||||
Long: restartCommand.Long,
|
||||
RunE: restartCommand.RunE,
|
||||
Args: restartCommand.Args,
|
||||
ValidArgsFunction: restartCommand.ValidArgsFunction,
|
||||
Example: `podman container restart ctrID
|
||||
podman container restart --latest
|
||||
|
@ -66,14 +67,12 @@ func restartFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: restartCommand,
|
||||
})
|
||||
restartFlags(restartCommand)
|
||||
validate.AddLatestFlag(restartCommand, &restartOptions.Latest)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerRestartCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -42,7 +42,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: restoreCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -38,13 +38,11 @@ var (
|
|||
}
|
||||
|
||||
containerRmCommand = &cobra.Command{
|
||||
Use: rmCommand.Use,
|
||||
Short: rmCommand.Short,
|
||||
Long: rmCommand.Long,
|
||||
RunE: rmCommand.RunE,
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
return validate.CheckAllLatestAndCIDFile(cmd, args, false, true)
|
||||
},
|
||||
Use: rmCommand.Use,
|
||||
Short: rmCommand.Short,
|
||||
Long: rmCommand.Long,
|
||||
RunE: rmCommand.RunE,
|
||||
Args: rmCommand.Args,
|
||||
ValidArgsFunction: rmCommand.ValidArgsFunction,
|
||||
Example: `podman container rm imageID
|
||||
podman container rm mywebserver myflaskserver 860a4b23
|
||||
|
@ -79,14 +77,12 @@ func rmFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: rmCommand,
|
||||
})
|
||||
rmFlags(rmCommand)
|
||||
validate.AddLatestFlag(rmCommand, &rmOptions.Latest)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerRmCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -91,14 +91,12 @@ func runFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: runCommand,
|
||||
})
|
||||
|
||||
runFlags(runCommand)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerRunCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -25,6 +25,7 @@ var (
|
|||
runlabelOptions = runlabelOptionsWrapper{}
|
||||
runlabelDescription = "Executes a command as described by a container image label."
|
||||
runlabelCommand = &cobra.Command{
|
||||
Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
|
||||
Use: "runlabel [options] LABEL IMAGE [ARG...]",
|
||||
Short: "Execute the command described by an image label",
|
||||
Long: runlabelDescription,
|
||||
|
@ -39,7 +40,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode},
|
||||
Command: runlabelCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -70,14 +70,12 @@ func startFlags(cmd *cobra.Command) {
|
|||
}
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: startCommand,
|
||||
})
|
||||
startFlags(startCommand)
|
||||
validate.AddLatestFlag(startCommand, &startOptions.Latest)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerStartCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -79,14 +79,12 @@ func statFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: statsCommand,
|
||||
})
|
||||
statFlags(statsCommand)
|
||||
validate.AddLatestFlag(statsCommand, &statsOptions.Latest)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerStatsCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -78,14 +78,12 @@ func stopFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: stopCommand,
|
||||
})
|
||||
stopFlags(stopCommand)
|
||||
validate.AddLatestFlag(stopCommand, &stopOptions.Latest)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerStopCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -58,7 +58,6 @@ func topFlags(flags *pflag.FlagSet) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: topCommand,
|
||||
})
|
||||
topFlags(topCommand.Flags())
|
||||
|
@ -71,7 +70,6 @@ func init() {
|
|||
}
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerTopCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -20,11 +20,12 @@ var (
|
|||
An unmount can be forced with the --force flag.
|
||||
`
|
||||
unmountCommand = &cobra.Command{
|
||||
Use: "unmount [options] CONTAINER [CONTAINER...]",
|
||||
Aliases: []string{"umount"},
|
||||
Short: "Unmounts working container's root filesystem",
|
||||
Long: description,
|
||||
RunE: unmount,
|
||||
Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
|
||||
Use: "unmount [options] CONTAINER [CONTAINER...]",
|
||||
Aliases: []string{"umount"},
|
||||
Short: "Unmounts working container's root filesystem",
|
||||
Long: description,
|
||||
RunE: unmount,
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
|
||||
},
|
||||
|
@ -35,11 +36,12 @@ var (
|
|||
}
|
||||
|
||||
containerUnmountCommand = &cobra.Command{
|
||||
Use: unmountCommand.Use,
|
||||
Short: unmountCommand.Short,
|
||||
Aliases: unmountCommand.Aliases,
|
||||
Long: unmountCommand.Long,
|
||||
RunE: unmountCommand.RunE,
|
||||
Annotations: unmountCommand.Annotations,
|
||||
Use: unmountCommand.Use,
|
||||
Short: unmountCommand.Short,
|
||||
Aliases: unmountCommand.Aliases,
|
||||
Long: unmountCommand.Long,
|
||||
RunE: unmountCommand.RunE,
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
|
||||
},
|
||||
|
@ -61,14 +63,12 @@ func unmountFlags(flags *pflag.FlagSet) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode},
|
||||
Command: unmountCommand,
|
||||
})
|
||||
unmountFlags(unmountCommand.Flags())
|
||||
validate.AddLatestFlag(unmountCommand, &unmountOpts.Latest)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode},
|
||||
Command: containerUnmountCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -45,14 +45,12 @@ func unpauseFlags(flags *pflag.FlagSet) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: unpauseCommand,
|
||||
})
|
||||
flags := unpauseCommand.Flags()
|
||||
unpauseFlags(flags)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerUnpauseCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -60,14 +60,12 @@ func waitFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: waitCommand,
|
||||
})
|
||||
waitFlags(waitCommand)
|
||||
validate.AddLatestFlag(waitCommand, &waitOptions.Latest)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: containerWaitCommand,
|
||||
Parent: containerCmd,
|
||||
})
|
||||
|
|
|
@ -34,7 +34,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: diffCmd,
|
||||
})
|
||||
flags := diffCmd.Flags()
|
||||
|
|
|
@ -3,7 +3,6 @@ package pods
|
|||
import (
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/cmd/podman/validate"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/containers/podman/v3/pkg/util"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -21,7 +20,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: generateCmd,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: kubeCmd,
|
||||
Parent: generateCmd,
|
||||
})
|
||||
|
|
|
@ -40,7 +40,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: systemdCmd,
|
||||
Parent: generateCmd,
|
||||
})
|
||||
|
|
|
@ -3,12 +3,10 @@ package healthcheck
|
|||
import (
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/cmd/podman/validate"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
// Command: healthcheck
|
||||
healthCmd = &cobra.Command{
|
||||
Use: "healthcheck",
|
||||
Short: "Manage health checks on containers",
|
||||
|
@ -19,7 +17,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: healthCmd,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -11,23 +11,20 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
healthcheckRunDescription = "run the health check of a container"
|
||||
healthcheckrunCommand = &cobra.Command{
|
||||
Use: "run CONTAINER",
|
||||
Short: "run the health check of a container",
|
||||
Long: healthcheckRunDescription,
|
||||
Example: `podman healthcheck run mywebapp`,
|
||||
RunE: run,
|
||||
Args: cobra.ExactArgs(1),
|
||||
ValidArgsFunction: common.AutocompleteContainersRunning,
|
||||
DisableFlagsInUseLine: true,
|
||||
runCmd = &cobra.Command{
|
||||
Use: "run CONTAINER",
|
||||
Short: "run the health check of a container",
|
||||
Long: "run the health check of a container",
|
||||
Example: `podman healthcheck run mywebapp`,
|
||||
RunE: run,
|
||||
Args: cobra.ExactArgs(1),
|
||||
ValidArgsFunction: common.AutocompleteContainersRunning,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: healthcheckrunCommand,
|
||||
Command: runCmd,
|
||||
Parent: healthCmd,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -82,14 +82,11 @@ func useLayers() string {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
|
||||
Command: buildCmd,
|
||||
})
|
||||
buildFlags(buildCmd)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: imageBuildCmd,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -27,7 +27,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: diffCmd,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -3,7 +3,6 @@ package images
|
|||
import (
|
||||
"github.com/containers/podman/v3/cmd/podman/common"
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -17,13 +16,11 @@ var (
|
|||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Example: `podman image exists ID
|
||||
podman image exists IMAGE && podman pull IMAGE`,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: existsCmd,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -56,13 +56,11 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: historyCmd,
|
||||
})
|
||||
historyFlags(historyCmd)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: imageHistoryCmd,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -3,7 +3,6 @@ package images
|
|||
import (
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/cmd/podman/validate"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -22,7 +21,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: imageCmd,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
package images
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
// podman _images_ Alias for podman image _list_
|
||||
imagesCmd = &cobra.Command{
|
||||
Use: strings.Replace(listCmd.Use, "list", "images", 1),
|
||||
Args: listCmd.Args,
|
||||
Short: listCmd.Short,
|
||||
Long: listCmd.Long,
|
||||
RunE: listCmd.RunE,
|
||||
ValidArgsFunction: listCmd.ValidArgsFunction,
|
||||
Example: strings.Replace(listCmd.Example, "podman image list", "podman images", -1),
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: imagesCmd,
|
||||
})
|
||||
|
||||
imageListFlagSet(imagesCmd)
|
||||
}
|
|
@ -51,13 +51,11 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: importCommand,
|
||||
})
|
||||
importFlags(importCommand)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: imageImportCommand,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -26,7 +26,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: inspectCmd,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -34,8 +34,7 @@ type listFlagType struct {
|
|||
}
|
||||
|
||||
var (
|
||||
// Command: podman image _list_
|
||||
listCmd = &cobra.Command{
|
||||
imageListCmd = &cobra.Command{
|
||||
Use: "list [options] [IMAGE]",
|
||||
Aliases: []string{"ls"},
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
|
@ -46,7 +45,18 @@ var (
|
|||
Example: `podman image list --format json
|
||||
podman image list --sort repository --format "table {{.ID}} {{.Repository}} {{.Tag}}"
|
||||
podman image list --filter dangling=true`,
|
||||
DisableFlagsInUseLine: true,
|
||||
}
|
||||
|
||||
imagesCmd = &cobra.Command{
|
||||
Use: "images [options] [IMAGE]",
|
||||
Args: imageListCmd.Args,
|
||||
Short: imageListCmd.Short,
|
||||
Long: imageListCmd.Long,
|
||||
RunE: imageListCmd.RunE,
|
||||
ValidArgsFunction: imageListCmd.ValidArgsFunction,
|
||||
Example: `podman images --format json
|
||||
podman images --sort repository --format "table {{.ID}} {{.Repository}} {{.Tag}}"
|
||||
podman images --filter dangling=true`,
|
||||
}
|
||||
|
||||
// Options to pull data
|
||||
|
@ -65,11 +75,15 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: listCmd,
|
||||
Command: imageListCmd,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
imageListFlagSet(listCmd)
|
||||
imageListFlagSet(imageListCmd)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Command: imagesCmd,
|
||||
})
|
||||
imageListFlagSet(imagesCmd)
|
||||
}
|
||||
|
||||
func imageListFlagSet(cmd *cobra.Command) {
|
||||
|
|
|
@ -45,12 +45,10 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: loadCommand,
|
||||
})
|
||||
loadFlags(loadCommand)
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: imageLoadCommand,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -24,6 +24,11 @@ var (
|
|||
`
|
||||
|
||||
mountCommand = &cobra.Command{
|
||||
Annotations: map[string]string{
|
||||
registry.UnshareNSRequired: "",
|
||||
registry.ParentNSRequired: "",
|
||||
registry.EngineMode: registry.ABIMode,
|
||||
},
|
||||
Use: "mount [options] [IMAGE...]",
|
||||
Short: "Mount an image's root filesystem",
|
||||
Long: mountDescription,
|
||||
|
@ -33,10 +38,6 @@ var (
|
|||
podman image mount imgID1 imgID2 imgID3
|
||||
podman image mount
|
||||
podman image mount --all`,
|
||||
Annotations: map[string]string{
|
||||
registry.UnshareNSRequired: "",
|
||||
registry.ParentNSRequired: "",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -56,7 +57,6 @@ func mountFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode},
|
||||
Command: mountCommand,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -34,7 +34,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: pruneCmd,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -60,14 +60,12 @@ var (
|
|||
func init() {
|
||||
// pull
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: pullCmd,
|
||||
})
|
||||
pullFlags(pullCmd)
|
||||
|
||||
// images pull
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: imagesPullCmd,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -57,14 +57,12 @@ var (
|
|||
func init() {
|
||||
// push
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: pushCmd,
|
||||
})
|
||||
pushFlags(pushCmd)
|
||||
|
||||
// images push
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: imagePushCmd,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -25,17 +25,33 @@ var (
|
|||
podman image rm c4dfb1609ee2 93fd78260bd1 c0ed59d05ff7`,
|
||||
}
|
||||
|
||||
rmiCmd = &cobra.Command{
|
||||
Use: "rmi [options] IMAGE [IMAGE...]",
|
||||
Args: rmCmd.Args,
|
||||
Short: rmCmd.Short,
|
||||
Long: rmCmd.Long,
|
||||
RunE: rmCmd.RunE,
|
||||
ValidArgsFunction: rmCmd.ValidArgsFunction,
|
||||
Example: `podman rmi imageID
|
||||
podman rmi --force alpine
|
||||
podman rmi c4dfb1609ee2 93fd78260bd1 c0ed59d05ff7`,
|
||||
}
|
||||
|
||||
imageOpts = entities.ImageRemoveOptions{}
|
||||
)
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: rmCmd,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
||||
imageRemoveFlagSet(rmCmd.Flags())
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Command: rmiCmd,
|
||||
})
|
||||
imageRemoveFlagSet(rmiCmd.Flags())
|
||||
}
|
||||
|
||||
func imageRemoveFlagSet(flags *pflag.FlagSet) {
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
package images
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
rmiCmd = &cobra.Command{
|
||||
Use: strings.Replace(rmCmd.Use, "rm ", "rmi ", 1),
|
||||
Args: rmCmd.Args,
|
||||
Short: rmCmd.Short,
|
||||
Long: rmCmd.Long,
|
||||
RunE: rmCmd.RunE,
|
||||
ValidArgsFunction: rmCmd.ValidArgsFunction,
|
||||
Example: strings.Replace(rmCmd.Example, "podman image rm", "podman rmi", -1),
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: rmiCmd,
|
||||
})
|
||||
imageRemoveFlagSet(rmiCmd.Flags())
|
||||
}
|
|
@ -48,6 +48,7 @@ var (
|
|||
podman save --format docker-dir -o ubuntu-dir ubuntu
|
||||
podman save > alpine-all.tar alpine:latest`,
|
||||
}
|
||||
|
||||
imageSaveCommand = &cobra.Command{
|
||||
Args: saveCommand.Args,
|
||||
Use: saveCommand.Use,
|
||||
|
@ -67,13 +68,11 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: saveCommand,
|
||||
})
|
||||
saveFlags(saveCommand)
|
||||
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: imageSaveCommand,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -38,7 +38,6 @@ var (
|
|||
|
||||
Users can limit the number of results, and filter the output based on certain conditions.`
|
||||
|
||||
// Command: podman search
|
||||
searchCmd = &cobra.Command{
|
||||
Use: "search [options] TERM",
|
||||
Short: "Search registry for image",
|
||||
|
@ -51,14 +50,12 @@ var (
|
|||
podman search --format "table {{.Index}} {{.Name}}" registry.fedoraproject.org/fedora`,
|
||||
}
|
||||
|
||||
// Command: podman image search
|
||||
imageSearchCmd = &cobra.Command{
|
||||
Use: searchCmd.Use,
|
||||
Short: searchCmd.Short,
|
||||
Long: searchCmd.Long,
|
||||
RunE: searchCmd.RunE,
|
||||
Args: searchCmd.Args,
|
||||
Annotations: searchCmd.Annotations,
|
||||
ValidArgsFunction: searchCmd.ValidArgsFunction,
|
||||
Example: `podman image search --filter=is-official --limit 3 alpine
|
||||
podman image search registry.fedoraproject.org/ # only works with v2 registries
|
||||
|
@ -67,16 +64,12 @@ var (
|
|||
)
|
||||
|
||||
func init() {
|
||||
// search
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: searchCmd,
|
||||
})
|
||||
searchFlags(searchCmd)
|
||||
|
||||
// images search
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: imageSearchCmd,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
var (
|
||||
signDescription = "Create a signature file that can be used later to verify the image."
|
||||
signCommand = &cobra.Command{
|
||||
Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
|
||||
Use: "sign [options] IMAGE [IMAGE...]",
|
||||
Short: "Sign an image",
|
||||
Long: signDescription,
|
||||
|
@ -31,7 +32,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode},
|
||||
Command: signCommand,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -10,26 +10,24 @@ import (
|
|||
var (
|
||||
tagDescription = "Adds one or more additional names to locally-stored image."
|
||||
tagCommand = &cobra.Command{
|
||||
Use: "tag IMAGE TARGET_NAME [TARGET_NAME...]",
|
||||
Short: "Add an additional name to a local image",
|
||||
Long: tagDescription,
|
||||
RunE: tag,
|
||||
Args: cobra.MinimumNArgs(2),
|
||||
DisableFlagsInUseLine: true,
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Use: "tag IMAGE TARGET_NAME [TARGET_NAME...]",
|
||||
Short: "Add an additional name to a local image",
|
||||
Long: tagDescription,
|
||||
RunE: tag,
|
||||
Args: cobra.MinimumNArgs(2),
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Example: `podman tag 0e3bbc2 fedora:latest
|
||||
podman tag imageID:latest myNewImage:newTag
|
||||
podman tag httpd myregistryhost:5000/fedora/httpd:v2`,
|
||||
}
|
||||
|
||||
imageTagCommand = &cobra.Command{
|
||||
Args: tagCommand.Args,
|
||||
DisableFlagsInUseLine: true,
|
||||
Use: tagCommand.Use,
|
||||
Short: tagCommand.Short,
|
||||
Long: tagCommand.Long,
|
||||
RunE: tagCommand.RunE,
|
||||
ValidArgsFunction: tagCommand.ValidArgsFunction,
|
||||
Args: tagCommand.Args,
|
||||
Use: tagCommand.Use,
|
||||
Short: tagCommand.Short,
|
||||
Long: tagCommand.Long,
|
||||
RunE: tagCommand.RunE,
|
||||
ValidArgsFunction: tagCommand.ValidArgsFunction,
|
||||
Example: `podman image tag 0e3bbc2 fedora:latest
|
||||
podman image tag imageID:latest myNewImage:newTag
|
||||
podman image tag httpd myregistryhost:5000/fedora/httpd:v2`,
|
||||
|
@ -38,11 +36,9 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: tagCommand,
|
||||
})
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: imageTagCommand,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -25,7 +25,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: treeCmd,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -3,7 +3,6 @@ package images
|
|||
import (
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/cmd/podman/validate"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -11,16 +10,16 @@ var (
|
|||
trustDescription = `Manages which registries you trust as a source of container images based on their location.
|
||||
The location is determined by the transport and the registry host of the image. Using this container image docker://quay.io/podman/stable as an example, docker is the transport and quay.io is the registry host.`
|
||||
trustCmd = &cobra.Command{
|
||||
Use: "trust",
|
||||
Short: "Manage container image trust policy",
|
||||
Long: trustDescription,
|
||||
RunE: validate.SubCommandExists,
|
||||
Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
|
||||
Use: "trust",
|
||||
Short: "Manage container image trust policy",
|
||||
Long: trustDescription,
|
||||
RunE: validate.SubCommandExists,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode},
|
||||
Command: trustCmd,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
|
|
|
@ -16,6 +16,7 @@ import (
|
|||
var (
|
||||
setTrustDescription = "Set default trust policy or add a new trust policy for a registry"
|
||||
setTrustCommand = &cobra.Command{
|
||||
Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
|
||||
Use: "set [options] REGISTRY",
|
||||
Short: "Set default trust policy or a new trust policy for a registry",
|
||||
Long: setTrustDescription,
|
||||
|
@ -32,7 +33,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode},
|
||||
Command: setTrustCommand,
|
||||
Parent: trustCmd,
|
||||
})
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
var (
|
||||
showTrustDescription = "Display trust policy for the system"
|
||||
showTrustCommand = &cobra.Command{
|
||||
Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
|
||||
Use: "show [options] [REGISTRY]",
|
||||
Short: "Display trust policy for the system",
|
||||
Long: showTrustDescription,
|
||||
|
@ -31,7 +32,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode},
|
||||
Command: showTrustCommand,
|
||||
Parent: trustCmd,
|
||||
})
|
||||
|
|
|
@ -20,6 +20,7 @@ var (
|
|||
An unmount can be forced with the --force flag.
|
||||
`
|
||||
unmountCommand = &cobra.Command{
|
||||
Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
|
||||
Use: "unmount [options] IMAGE [IMAGE...]",
|
||||
Aliases: []string{"umount"},
|
||||
Short: "Unmount an image's root filesystem",
|
||||
|
@ -43,7 +44,6 @@ func unmountFlags(flags *pflag.FlagSet) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode},
|
||||
Parent: imageCmd,
|
||||
Command: unmountCommand,
|
||||
})
|
||||
|
|
|
@ -8,27 +8,25 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
untagCommand = &cobra.Command{
|
||||
Use: "untag IMAGE [IMAGE...]",
|
||||
Short: "Remove a name from a local image",
|
||||
Long: "Removes one or more names from a locally-stored image.",
|
||||
RunE: untag,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
DisableFlagsInUseLine: true,
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
untagCmd = &cobra.Command{
|
||||
Use: "untag IMAGE [IMAGE...]",
|
||||
Short: "Remove a name from a local image",
|
||||
Long: "Removes one or more names from a locally-stored image.",
|
||||
RunE: untag,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Example: `podman untag 0e3bbc2
|
||||
podman untag imageID:latest otherImageName:latest
|
||||
podman untag httpd myregistryhost:5000/fedora/httpd:v2`,
|
||||
}
|
||||
|
||||
imageUntagCommand = &cobra.Command{
|
||||
Args: untagCommand.Args,
|
||||
DisableFlagsInUseLine: true,
|
||||
Use: untagCommand.Use,
|
||||
Short: untagCommand.Short,
|
||||
Long: untagCommand.Long,
|
||||
RunE: untagCommand.RunE,
|
||||
ValidArgsFunction: untagCommand.ValidArgsFunction,
|
||||
imageUntagCmd = &cobra.Command{
|
||||
Args: untagCmd.Args,
|
||||
Use: untagCmd.Use,
|
||||
Short: untagCmd.Short,
|
||||
Long: untagCmd.Long,
|
||||
RunE: untagCmd.RunE,
|
||||
ValidArgsFunction: untagCmd.ValidArgsFunction,
|
||||
Example: `podman image untag 0e3bbc2
|
||||
podman image untag imageID:latest otherImageName:latest
|
||||
podman image untag httpd myregistryhost:5000/fedora/httpd:v2`,
|
||||
|
@ -37,12 +35,10 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: untagCommand,
|
||||
Command: untagCmd,
|
||||
})
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: imageUntagCommand,
|
||||
Command: imageUntagCmd,
|
||||
Parent: imageCmd,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: inspectCmd,
|
||||
})
|
||||
inspectOpts = inspect.AddInspectFlagSet(inspectCmd)
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/containers/image/v5/types"
|
||||
"github.com/containers/podman/v3/cmd/podman/common"
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/containers/podman/v3/pkg/registries"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -39,7 +38,6 @@ func init() {
|
|||
// store credentials locally while the remote client will pass them
|
||||
// over the wire to the endpoint.
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: loginCommand,
|
||||
})
|
||||
flags := loginCommand.Flags()
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"github.com/containers/image/v5/types"
|
||||
"github.com/containers/podman/v3/cmd/podman/common"
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/containers/podman/v3/pkg/registries"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -33,7 +32,6 @@ func init() {
|
|||
// store credentials locally while the remote client will pass them
|
||||
// over the wire to the endpoint.
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: logoutCommand,
|
||||
})
|
||||
flags := logoutCommand.Flags()
|
||||
|
|
|
@ -5,7 +5,6 @@ package machine
|
|||
import (
|
||||
"github.com/containers/common/pkg/completion"
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/containers/podman/v3/pkg/machine"
|
||||
"github.com/containers/podman/v3/pkg/machine/qemu"
|
||||
"github.com/pkg/errors"
|
||||
|
@ -25,13 +24,12 @@ var (
|
|||
)
|
||||
|
||||
var (
|
||||
initOpts = machine.InitOptions{}
|
||||
defaultMachineName string = "podman-machine-default"
|
||||
initOpts = machine.InitOptions{}
|
||||
defaultMachineName = "podman-machine-default"
|
||||
)
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: initCmd,
|
||||
Parent: machineCmd,
|
||||
})
|
||||
|
|
|
@ -15,7 +15,6 @@ import (
|
|||
"github.com/containers/podman/v3/cmd/podman/parse"
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/cmd/podman/validate"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/containers/podman/v3/pkg/machine"
|
||||
"github.com/containers/podman/v3/pkg/machine/qemu"
|
||||
"github.com/docker/go-units"
|
||||
|
@ -25,15 +24,15 @@ import (
|
|||
|
||||
var (
|
||||
lsCmd = &cobra.Command{
|
||||
Use: "list [options]",
|
||||
Aliases: []string{"ls"},
|
||||
Short: "List machines",
|
||||
Long: "List managed virtual machines.",
|
||||
RunE: list,
|
||||
Args: validate.NoArgs,
|
||||
Use: "list [options]",
|
||||
Aliases: []string{"ls"},
|
||||
Short: "List machines",
|
||||
Long: "List managed virtual machines.",
|
||||
RunE: list,
|
||||
Args: validate.NoArgs,
|
||||
ValidArgsFunction: completion.AutocompleteNone,
|
||||
Example: `podman machine list,
|
||||
podman machine ls`,
|
||||
ValidArgsFunction: completion.AutocompleteNone,
|
||||
}
|
||||
listFlag = listFlagType{}
|
||||
)
|
||||
|
@ -52,7 +51,6 @@ type machineReporter struct {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: lsCmd,
|
||||
Parent: machineCmd,
|
||||
})
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/cmd/podman/validate"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/containers/podman/v3/pkg/machine"
|
||||
"github.com/containers/podman/v3/pkg/machine/qemu"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -30,7 +29,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: machineCmd,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
|
||||
package machine
|
||||
|
||||
// init do not register _podman machine_ command on unsupported platforms
|
||||
func init() {}
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/containers/podman/v3/pkg/machine"
|
||||
"github.com/containers/podman/v3/pkg/machine/qemu"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -33,7 +32,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: rmCmd,
|
||||
Parent: machineCmd,
|
||||
})
|
||||
|
|
|
@ -4,7 +4,6 @@ package machine
|
|||
|
||||
import (
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/containers/podman/v3/pkg/machine"
|
||||
"github.com/containers/podman/v3/pkg/machine/qemu"
|
||||
"github.com/pkg/errors"
|
||||
|
@ -30,7 +29,6 @@ var (
|
|||
func init() {
|
||||
sshCmd.Flags().SetInterspersed(false)
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: sshCmd,
|
||||
Parent: machineCmd,
|
||||
})
|
||||
|
|
|
@ -4,7 +4,6 @@ package machine
|
|||
|
||||
import (
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/containers/podman/v3/pkg/machine"
|
||||
"github.com/containers/podman/v3/pkg/machine/qemu"
|
||||
"github.com/pkg/errors"
|
||||
|
@ -25,7 +24,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: startCmd,
|
||||
Parent: machineCmd,
|
||||
})
|
||||
|
|
|
@ -4,7 +4,6 @@ package machine
|
|||
|
||||
import (
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/containers/podman/v3/pkg/machine"
|
||||
"github.com/containers/podman/v3/pkg/machine/qemu"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -24,7 +23,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: stopCmd,
|
||||
Parent: machineCmd,
|
||||
})
|
||||
|
|
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
_ "github.com/containers/podman/v3/cmd/podman/completion"
|
||||
_ "github.com/containers/podman/v3/cmd/podman/containers"
|
||||
|
@ -42,38 +43,41 @@ func main() {
|
|||
func parseCommands() *cobra.Command {
|
||||
cfg := registry.PodmanConfig()
|
||||
for _, c := range registry.Commands {
|
||||
for _, m := range c.Mode {
|
||||
if cfg.EngineMode == m {
|
||||
// Command cannot be run rootless
|
||||
_, found := c.Command.Annotations[registry.UnshareNSRequired]
|
||||
if found {
|
||||
if rootless.IsRootless() && found && os.Getuid() != 0 {
|
||||
c.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return fmt.Errorf("cannot run command %q in rootless mode, must execute `podman unshare` first", cmd.CommandPath())
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_, found = c.Command.Annotations[registry.ParentNSRequired]
|
||||
if rootless.IsRootless() && found {
|
||||
c.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return fmt.Errorf("cannot run command %q in rootless mode", cmd.CommandPath())
|
||||
}
|
||||
}
|
||||
}
|
||||
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)
|
||||
c.Command.DisableFlagsInUseLine = true
|
||||
if supported, found := c.Command.Annotations[registry.EngineMode]; found {
|
||||
if !strings.Contains(cfg.EngineMode.String(), supported) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// Command cannot be run rootless
|
||||
_, found := c.Command.Annotations[registry.UnshareNSRequired]
|
||||
if found {
|
||||
if rootless.IsRootless() && os.Getuid() != 0 {
|
||||
c.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return fmt.Errorf("cannot run command %q in rootless mode, must execute `podman unshare` first", cmd.CommandPath())
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_, found = c.Command.Annotations[registry.ParentNSRequired]
|
||||
if rootless.IsRootless() && found {
|
||||
c.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
return fmt.Errorf("cannot run command %q in rootless mode", cmd.CommandPath())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
c.Command.DisableFlagsInUseLine = true
|
||||
}
|
||||
if err := terminal.SetConsole(); err != nil {
|
||||
logrus.Error(err)
|
||||
|
|
|
@ -39,7 +39,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: addCmd,
|
||||
Parent: manifestCmd,
|
||||
})
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
var (
|
||||
manifestAnnotateOpts = entities.ManifestAnnotateOptions{}
|
||||
annotateCmd = &cobra.Command{
|
||||
Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
|
||||
Use: "annotate [options] LIST IMAGE",
|
||||
Short: "Add or update information about an entry in a manifest list or image index",
|
||||
Long: "Adds or updates information about an entry in a manifest list or image index.",
|
||||
|
@ -27,7 +28,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode},
|
||||
Command: annotateCmd,
|
||||
Parent: manifestCmd,
|
||||
})
|
||||
|
|
|
@ -27,7 +27,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: createCmd,
|
||||
Parent: manifestCmd,
|
||||
})
|
||||
|
|
|
@ -3,7 +3,6 @@ package manifest
|
|||
import (
|
||||
"github.com/containers/podman/v3/cmd/podman/common"
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -21,7 +20,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: existsCmd,
|
||||
Parent: manifestCmd,
|
||||
})
|
||||
|
|
|
@ -6,26 +6,23 @@ import (
|
|||
|
||||
"github.com/containers/podman/v3/cmd/podman/common"
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
inspectCmd = &cobra.Command{
|
||||
Use: "inspect IMAGE",
|
||||
Short: "Display the contents of a manifest list or image index",
|
||||
Long: "Display the contents of a manifest list or image index.",
|
||||
RunE: inspect,
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Example: "podman manifest inspect localhost/list",
|
||||
Args: cobra.ExactArgs(1),
|
||||
DisableFlagsInUseLine: true,
|
||||
Use: "inspect IMAGE",
|
||||
Short: "Display the contents of a manifest list or image index",
|
||||
Long: "Display the contents of a manifest list or image index.",
|
||||
RunE: inspect,
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Example: "podman manifest inspect localhost/list",
|
||||
Args: cobra.ExactArgs(1),
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: inspectCmd,
|
||||
Parent: manifestCmd,
|
||||
})
|
||||
|
|
|
@ -3,7 +3,6 @@ package manifest
|
|||
import (
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/cmd/podman/validate"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -26,7 +25,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: manifestCmd,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: pushCmd,
|
||||
Parent: manifestCmd,
|
||||
})
|
||||
|
|
|
@ -6,27 +6,24 @@ import (
|
|||
|
||||
"github.com/containers/podman/v3/cmd/podman/common"
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
removeCmd = &cobra.Command{
|
||||
Use: "remove LIST IMAGE",
|
||||
Short: "Remove an entry from a manifest list or image index",
|
||||
Long: "Removes an image from a manifest list or image index.",
|
||||
RunE: remove,
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Example: `podman manifest remove mylist:v1.11 sha256:15352d97781ffdf357bf3459c037be3efac4133dc9070c2dce7eca7c05c3e736`,
|
||||
Args: cobra.ExactArgs(2),
|
||||
DisableFlagsInUseLine: true,
|
||||
Use: "remove LIST IMAGE",
|
||||
Short: "Remove an entry from a manifest list or image index",
|
||||
Long: "Removes an image from a manifest list or image index.",
|
||||
RunE: remove,
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Example: `podman manifest remove mylist:v1.11 sha256:15352d97781ffdf357bf3459c037be3efac4133dc9070c2dce7eca7c05c3e736`,
|
||||
Args: cobra.ExactArgs(2),
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: removeCmd,
|
||||
Parent: manifestCmd,
|
||||
})
|
||||
|
|
|
@ -6,27 +6,24 @@ import (
|
|||
|
||||
"github.com/containers/podman/v3/cmd/podman/common"
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/containers/podman/v3/pkg/errorhandling"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
rmCmd = &cobra.Command{
|
||||
Use: "rm LIST",
|
||||
Short: "Remove manifest list or image index from local storage",
|
||||
Long: "Remove manifest list or image index from local storage.",
|
||||
RunE: rm,
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Example: `podman manifest rm mylist:v1.11`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
DisableFlagsInUseLine: true,
|
||||
Use: "rm LIST",
|
||||
Short: "Remove manifest list or image index from local storage",
|
||||
Long: "Remove manifest list or image index from local storage.",
|
||||
RunE: rm,
|
||||
ValidArgsFunction: common.AutocompleteImages,
|
||||
Example: `podman manifest rm mylist:v1.11`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: rmCmd,
|
||||
Parent: manifestCmd,
|
||||
})
|
||||
|
|
|
@ -34,7 +34,6 @@ func networkConnectFlags(cmd *cobra.Command) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: networkConnectCommand,
|
||||
Parent: networkCmd,
|
||||
})
|
||||
|
|
|
@ -75,7 +75,6 @@ func networkCreateFlags(cmd *cobra.Command) {
|
|||
}
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: networkCreateCommand,
|
||||
Parent: networkCmd,
|
||||
})
|
||||
|
|
|
@ -31,7 +31,6 @@ func networkDisconnectFlags(flags *pflag.FlagSet) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: networkDisconnectCommand,
|
||||
Parent: networkCmd,
|
||||
})
|
||||
|
|
|
@ -3,7 +3,6 @@ package network
|
|||
import (
|
||||
"github.com/containers/podman/v3/cmd/podman/common"
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -22,7 +21,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: networkExistsCommand,
|
||||
Parent: networkCmd,
|
||||
})
|
||||
|
|
|
@ -24,7 +24,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: networkinspectCommand,
|
||||
Parent: networkCmd,
|
||||
})
|
||||
|
|
|
@ -54,7 +54,6 @@ func networkListFlags(flags *pflag.FlagSet) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: networklistCommand,
|
||||
Parent: networkCmd,
|
||||
})
|
||||
|
|
|
@ -3,7 +3,6 @@ package network
|
|||
import (
|
||||
"github.com/containers/podman/v3/cmd/podman/registry"
|
||||
"github.com/containers/podman/v3/cmd/podman/validate"
|
||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -22,7 +21,6 @@ var (
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: networkCmd,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ func networkPruneFlags(cmd *cobra.Command, flags *pflag.FlagSet) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: networkPruneCommand,
|
||||
Parent: networkCmd,
|
||||
})
|
||||
|
|
|
@ -15,10 +15,11 @@ import (
|
|||
var (
|
||||
networkReloadDescription = `reload container networks, recreating firewall rules`
|
||||
networkReloadCommand = &cobra.Command{
|
||||
Use: "reload [options] [CONTAINER...]",
|
||||
Short: "Reload firewall rules for one or more containers",
|
||||
Long: networkReloadDescription,
|
||||
RunE: networkReload,
|
||||
Annotations: map[string]string{registry.EngineMode: registry.ABIMode},
|
||||
Use: "reload [options] [CONTAINER...]",
|
||||
Short: "Reload firewall rules for one or more containers",
|
||||
Long: networkReloadDescription,
|
||||
RunE: networkReload,
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
|
||||
},
|
||||
|
@ -39,7 +40,6 @@ func reloadFlags(flags *pflag.FlagSet) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode},
|
||||
Command: networkReloadCommand,
|
||||
Parent: networkCmd,
|
||||
})
|
||||
|
|
|
@ -38,7 +38,6 @@ func networkRmFlags(flags *pflag.FlagSet) {
|
|||
|
||||
func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{
|
||||
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
|
||||
Command: networkrmCommand,
|
||||
Parent: networkCmd,
|
||||
})
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue