ui: move SetDryRun to ProgressReporter

This commit is contained in:
Michael Eischer
2021-09-12 15:25:58 +02:00
parent 77b129ec74
commit d62bfed65d
4 changed files with 13 additions and 19 deletions
+2 -7
View File
@@ -17,7 +17,6 @@ type Backup struct {
*StdioWrapper
term *termstatus.Terminal
dry bool // true if writes are faked
}
// NewBackup returns a new backup progress reporter.
@@ -165,14 +164,14 @@ func (b *Backup) Reset() {
}
// Finish prints the finishing messages.
func (b *Backup) Finish(snapshotID restic.ID, start time.Time, summary *Summary) {
func (b *Backup) Finish(snapshotID restic.ID, start time.Time, summary *Summary, dryRun bool) {
b.P("\n")
b.P("Files: %5d new, %5d changed, %5d unmodified\n", summary.Files.New, summary.Files.Changed, summary.Files.Unchanged)
b.P("Dirs: %5d new, %5d changed, %5d unmodified\n", summary.Dirs.New, summary.Dirs.Changed, summary.Dirs.Unchanged)
b.V("Data Blobs: %5d new\n", summary.ItemStats.DataBlobs)
b.V("Tree Blobs: %5d new\n", summary.ItemStats.TreeBlobs)
verb := "Added"
if b.dry {
if dryRun {
verb = "Would add"
}
b.P("%s to the repo: %-5s\n", verb, formatBytes(summary.ItemStats.DataSize+summary.ItemStats.TreeSize))
@@ -183,7 +182,3 @@ func (b *Backup) Finish(snapshotID restic.ID, start time.Time, summary *Summary)
formatDuration(time.Since(start)),
)
}
func (b *Backup) SetDryRun() {
b.dry = true
}