summaryrefslogtreecommitdiff
path: root/cmd/podman/containers/cp.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/containers/cp.go')
-rw-r--r--cmd/podman/containers/cp.go26
1 files changed, 24 insertions, 2 deletions
diff --git a/cmd/podman/containers/cp.go b/cmd/podman/containers/cp.go
index f0f9a158d..ac7037621 100644
--- a/cmd/podman/containers/cp.go
+++ b/cmd/podman/containers/cp.go
@@ -7,6 +7,7 @@ import (
"github.com/containers/libpod/pkg/rootless"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
+ "github.com/spf13/pflag"
)
var (
@@ -22,20 +23,41 @@ var (
RunE: cp,
Example: "podman cp [CONTAINER:]SRC_PATH [CONTAINER:]DEST_PATH",
}
+
+ containerCpCommand = &cobra.Command{
+ Use: cpCommand.Use,
+ Short: cpCommand.Short,
+ Long: cpCommand.Long,
+ Args: cpCommand.Args,
+ RunE: cpCommand.RunE,
+ Example: "podman container cp [CONTAINER:]SRC_PATH [CONTAINER:]DEST_PATH",
+ }
)
var (
cpOpts entities.ContainerCpOptions
)
+func cpFlags(flags *pflag.FlagSet) {
+ flags.BoolVar(&cpOpts.Extract, "extract", false, "Extract the tar file into the destination directory.")
+ flags.BoolVar(&cpOpts.Pause, "pause", copyPause(), "Pause the container while copying")
+}
+
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Mode: []entities.EngineMode{entities.ABIMode},
Command: cpCommand,
})
flags := cpCommand.Flags()
- flags.BoolVar(&cpOpts.Extract, "extract", false, "Extract the tar file into the destination directory.")
- flags.BoolVar(&cpOpts.Pause, "pause", copyPause(), "Pause the container while copying")
+ cpFlags(flags)
+
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Mode: []entities.EngineMode{entities.ABIMode},
+ Command: containerCpCommand,
+ Parent: containerCmd,
+ })
+ containerCpFlags := containerCpCommand.Flags()
+ cpFlags(containerCpFlags)
}
func cp(cmd *cobra.Command, args []string) error {