ui: move SetDryRun to ProgressReporter

This commit is contained in:
Michael Eischer
2021-08-18 13:03:08 +02:00
parent 77b129ec74
commit d62bfed65d
4 changed files with 13 additions and 19 deletions
+2 -8
View File
@@ -20,7 +20,6 @@ type Backup struct {
term *termstatus.Terminal
v uint
dry bool
}
// NewBackup returns a new backup progress reporter.
@@ -169,7 +168,7 @@ func (b *Backup) ReportTotal(item string, start time.Time, s archiver.ScanStats)
}
// Finish prints the finishing messages.
func (b *Backup) Finish(snapshotID restic.ID, start time.Time, summary *ui.Summary) {
func (b *Backup) Finish(snapshotID restic.ID, start time.Time, summary *ui.Summary, dryRun bool) {
b.print(summaryOutput{
MessageType: "summary",
FilesNew: summary.Files.New,
@@ -185,7 +184,7 @@ func (b *Backup) Finish(snapshotID restic.ID, start time.Time, summary *ui.Summa
TotalBytesProcessed: summary.ProcessedBytes,
TotalDuration: time.Since(start).Seconds(),
SnapshotID: snapshotID.Str(),
DryRun: b.dry,
DryRun: dryRun,
})
}
@@ -193,11 +192,6 @@ func (b *Backup) Finish(snapshotID restic.ID, start time.Time, summary *ui.Summa
func (b *Backup) Reset() {
}
// SetDryRun marks the backup as a "dry run".
func (b *Backup) SetDryRun() {
b.dry = true
}
type statusUpdate struct {
MessageType string `json:"message_type"` // "status"
SecondsElapsed uint64 `json:"seconds_elapsed,omitempty"`