mirror of
https://github.com/containers/podman.git
synced 2025-11-30 01:58:46 +08:00
Add a new `podman machine cp` subcommand to allow users to copy files or directories between a running Podman Machine and their host. Tests cover the following cases: - Copy a file from the host machine to the VM - Copy a directory from the host machine to the VM - Copy a file from the VM to the host machine - Copy a directory from the VM to the host machine - Copy a file to a directory - Copy a directory to a file Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
38 lines
545 B
Go
38 lines
545 B
Go
package e2e_test
|
|
|
|
type cpMachine struct {
|
|
quiet bool
|
|
src string
|
|
dest string
|
|
|
|
cmd []string
|
|
}
|
|
|
|
func (c *cpMachine) buildCmd(m *machineTestBuilder) []string {
|
|
cmd := []string{"machine", "cp"}
|
|
|
|
if c.quiet {
|
|
cmd = append(cmd, "--quiet")
|
|
}
|
|
|
|
cmd = append(cmd, c.src, c.dest)
|
|
|
|
c.cmd = cmd
|
|
return cmd
|
|
}
|
|
|
|
func (c *cpMachine) withQuiet() *cpMachine {
|
|
c.quiet = true
|
|
return c
|
|
}
|
|
|
|
func (c *cpMachine) withSrc(src string) *cpMachine {
|
|
c.src = src
|
|
return c
|
|
}
|
|
|
|
func (c *cpMachine) withDest(dest string) *cpMachine {
|
|
c.dest = dest
|
|
return c
|
|
}
|