(ctx context.Context, projectName string, options api.CopyOptions, direction copyDirection, serviceName string)
| 113 | } |
| 114 | |
| 115 | func (s *composeService) listContainersTargetedForCopy(ctx context.Context, projectName string, options api.CopyOptions, direction copyDirection, serviceName string) (Containers, error) { |
| 116 | var containers Containers |
| 117 | var err error |
| 118 | switch { |
| 119 | case options.Index > 0: |
| 120 | ctr, err := s.getSpecifiedContainer(ctx, projectName, oneOffExclude, true, serviceName, options.Index) |
| 121 | if err != nil { |
| 122 | return nil, err |
| 123 | } |
| 124 | return append(containers, ctr), nil |
| 125 | default: |
| 126 | withOneOff := oneOffExclude |
| 127 | if options.All { |
| 128 | withOneOff = oneOffInclude |
| 129 | } |
| 130 | containers, err = s.getContainers(ctx, projectName, withOneOff, true, serviceName) |
| 131 | if err != nil { |
| 132 | return nil, err |
| 133 | } |
| 134 | |
| 135 | if len(containers) < 1 { |
| 136 | return nil, fmt.Errorf("no container found for service %q", serviceName) |
| 137 | } |
| 138 | if direction == fromService { |
| 139 | return containers[:1], err |
| 140 | } |
| 141 | return containers, err |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | func (s *composeService) copyToContainer(ctx context.Context, containerID string, srcPath string, dstPath string, opts api.CopyOptions) error { |
| 146 | var err error |
no test coverage detected