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

@@ -11,6 +11,7 @@ type State struct {
FilesFinished uint64
FilesTotal uint64
FilesSkipped uint64
FilesDeleted uint64
AllBytesWritten uint64
AllBytesTotal uint64
AllBytesSkipped uint64
@@ -124,11 +125,13 @@ func (p *Progress) AddSkippedFile(name string, size uint64) {
p.printer.CompleteItem(ActionFileUnchanged, name, size)
}
func (p *Progress) ReportDeletedFile(name string) {
func (p *Progress) ReportDeletion(name string) {
if p == nil {
return
}
p.s.FilesDeleted++
p.m.Lock()
defer p.m.Unlock()