| 315 | } |
| 316 | |
| 317 | func (c *commandRestore) detectRestoreMode(ctx context.Context, m, targetpath string) string { |
| 318 | if m != "auto" { |
| 319 | return m |
| 320 | } |
| 321 | |
| 322 | switch { |
| 323 | case strings.HasSuffix(targetpath, ".zip"): |
| 324 | log(ctx).Infof("Restoring to a zip file (%v)...", targetpath) |
| 325 | return restoreModeZip |
| 326 | |
| 327 | case strings.HasSuffix(targetpath, ".tar"): |
| 328 | log(ctx).Infof("Restoring to an uncompressed tar file (%v)...", targetpath) |
| 329 | return restoreModeTar |
| 330 | |
| 331 | case strings.HasSuffix(targetpath, ".tar.gz") || strings.HasSuffix(targetpath, ".tgz"): |
| 332 | log(ctx).Infof("Restoring to a tar+gzip file (%v)...", targetpath) |
| 333 | return restoreModeTgz |
| 334 | |
| 335 | default: |
| 336 | log(ctx).Infof("Restoring to local filesystem (%v) with parallelism=%v...", targetpath, c.restoreParallel) |
| 337 | return restoreModeLocal |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | func printRestoreStats(ctx context.Context, st *restore.Stats) { |
| 342 | var maybeSkipped, maybeDeletedDirs, maybeDeletedFiles, maybeDeletedSymlinks, maybeErrors string |