(ctx context.Context, rep repo.Repository)
| 314 | } |
| 315 | |
| 316 | func (c *commandSnapshotMigrate) getSourcesToMigrate(ctx context.Context, rep repo.Repository) ([]snapshot.SourceInfo, error) { |
| 317 | if len(c.migrateSources) > 0 { |
| 318 | var result []snapshot.SourceInfo |
| 319 | |
| 320 | for _, s := range c.migrateSources { |
| 321 | si, err := snapshot.ParseSourceInfo(s, rep.ClientOptions().Hostname, rep.ClientOptions().Username) |
| 322 | if err != nil { |
| 323 | return nil, errors.Wrapf(err, "unable to parse %q", s) |
| 324 | } |
| 325 | |
| 326 | result = append(result, si) |
| 327 | } |
| 328 | |
| 329 | return result, nil |
| 330 | } |
| 331 | |
| 332 | if c.migrateAll { |
| 333 | //nolint:wrapcheck |
| 334 | return snapshot.ListSources(ctx, rep) |
| 335 | } |
| 336 | |
| 337 | return nil, errors.New("must specify either --all or --sources") |
| 338 | } |
no test coverage detected