ui: restore --delete indicates number of deleted files (#5100)

* ui: restore --delete indicates number of deleted files

* adds new field `FilesDeleted` to the State struct, JSON and text progress updaters
* increment FilesDeleted count when ReportedDeletedFile

* ui: collect the files to be deleted, delete, then update the count post deletion

* docs: update scripting output fields for restore command

ui: report deleted directories and refactor function name to ReportDeletion
This commit is contained in:
Srigovind Nayak
2024-12-01 19:59:11 +05:30
committed by GitHub
parent 2f0049cd6c
commit d7d9af4c9f
9 changed files with 64 additions and 21 deletions

View File

@@ -30,6 +30,9 @@ func (t *textPrinter) Update(p State, duration time.Duration) {
if p.FilesSkipped > 0 {
progress += fmt.Sprintf(", skipped %v files/dirs %v", p.FilesSkipped, ui.FormatBytes(p.AllBytesSkipped))
}
if p.FilesDeleted > 0 {
progress += fmt.Sprintf(", deleted %v files/dirs", p.FilesDeleted)
}
t.terminal.SetStatus([]string{progress})
}
@@ -82,6 +85,9 @@ func (t *textPrinter) Finish(p State, duration time.Duration) {
if p.FilesSkipped > 0 {
summary += fmt.Sprintf(", skipped %v files/dirs %v", p.FilesSkipped, ui.FormatBytes(p.AllBytesSkipped))
}
if p.FilesDeleted > 0 {
summary += fmt.Sprintf(", deleted %v files/dirs", p.FilesDeleted)
}
t.terminal.Print(summary)
}