Make CreateCommands and ScpCreateCommandsOptions private

They are entirely private, and the type has no reason to
exist in the API definitions.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
Miloslav Trmač
2026-03-04 00:20:43 +01:00
parent acdaa5372e
commit a725f55ff1
2 changed files with 18 additions and 18 deletions

View File

@@ -88,10 +88,3 @@ type ScpSaveToRemoteOptions struct {
}
type ScpSaveToRemoteReport struct{}
type ScpCreateCommandsOptions struct {
// ParentFlags are the arguments to apply to the parent podman command when called via ssh
ParentFlags []string
// Podman is the path to the local podman executable
Podman string
}

View File

@@ -88,10 +88,10 @@ func ExecuteTransfer(src, dst string, opts entities.ScpExecuteTransferOptions) (
return nil, err
}
createCommandOpts := entities.ScpCreateCommandsOptions{}
createCommandOpts.ParentFlags = opts.ParentFlags
createCommandOpts.Podman = podman
saveCmd, loadCmd := CreateCommands(source, dest, createCommandOpts)
createCommandOpts := scpCreateCommandsOptions{}
createCommandOpts.parentFlags = opts.ParentFlags
createCommandOpts.podman = podman
saveCmd, loadCmd := createCommands(source, dest, createCommandOpts)
switch {
case source.Remote: // if we want to load FROM the remote, dest can either be local or remote in this case
@@ -331,13 +331,20 @@ func ExecPodman(dest entities.ScpTransferImageOptions, podman string, command []
return "", cmd.Run()
}
// CreateCommands forms the podman save and load commands used by SCP
func CreateCommands(source entities.ScpTransferImageOptions, dest entities.ScpTransferImageOptions, opts entities.ScpCreateCommandsOptions) ([]string, []string) {
loadCmd := []string{opts.Podman}
saveCmd := []string{opts.Podman}
if len(opts.ParentFlags) > 0 {
loadCmd = append(loadCmd, opts.ParentFlags...)
saveCmd = append(saveCmd, opts.ParentFlags...)
type scpCreateCommandsOptions struct {
// parentFlags are the arguments to apply to the parent podman command when called via ssh
parentFlags []string
// podman is the path to the local podman executable
podman string
}
// createCommands forms the podman save and load commands used by SCP
func createCommands(source entities.ScpTransferImageOptions, dest entities.ScpTransferImageOptions, opts scpCreateCommandsOptions) ([]string, []string) {
loadCmd := []string{opts.podman}
saveCmd := []string{opts.podman}
if len(opts.parentFlags) > 0 {
loadCmd = append(loadCmd, opts.parentFlags...)
saveCmd = append(saveCmd, opts.parentFlags...)
}
loadCmd = append(loadCmd, "load")
saveCmd = append(saveCmd, "save")