mirror of
https://github.com/restic/restic.git
synced 2026-06-27 11:04:17 +00:00
backup - show excluded files and directories in verbose mode - text/JSON (#21887)
This commit is contained in:
committed by
GitHub
parent
8d7679c831
commit
d30d6b6281
@@ -251,3 +251,18 @@ type summaryOutput struct {
|
||||
SnapshotID string `json:"snapshot_id,omitempty"`
|
||||
DryRun bool `json:"dry_run,omitempty"`
|
||||
}
|
||||
|
||||
type VerboseExclude struct {
|
||||
MessageType string `json:"message_type"` // "excluded_item"
|
||||
Item string `json:"item"` // file or directory name
|
||||
}
|
||||
|
||||
func (b *jsonProgress) ExcludedItem(path string) {
|
||||
if b.v < 2 {
|
||||
return
|
||||
}
|
||||
b.print(VerboseExclude{
|
||||
MessageType: "excluded_item",
|
||||
Item: path,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ type ProgressPrinter interface {
|
||||
ReportTotal(start time.Time, s archiver.ScanStats)
|
||||
Finish(snapshotID restic.ID, summary *archiver.Summary, dryRun bool)
|
||||
Reset()
|
||||
ExcludedItem(path string)
|
||||
|
||||
restic.Printer
|
||||
}
|
||||
@@ -162,3 +163,7 @@ func (p *Progress) Finish(snapshotID restic.ID, summary *archiver.Summary, dryru
|
||||
p.Updater.Done()
|
||||
p.printer.Finish(snapshotID, summary, dryrun)
|
||||
}
|
||||
|
||||
func (p *Progress) ExcludedItem(path string) {
|
||||
p.printer.ExcludedItem(path)
|
||||
}
|
||||
|
||||
@@ -41,7 +41,8 @@ func (p *mockPrinter) Finish(id restic.ID, _ *archiver.Summary, _ bool) {
|
||||
p.id = id
|
||||
}
|
||||
|
||||
func (p *mockPrinter) Reset() {}
|
||||
func (p *mockPrinter) Reset() {}
|
||||
func (p *mockPrinter) ExcludedItem(_ string) {}
|
||||
|
||||
func TestProgress(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -158,3 +158,7 @@ func (b *textProgress) Finish(id restic.ID, summary *archiver.Summary, dryRun bo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (b *textProgress) ExcludedItem(path string) {
|
||||
b.VV("excluded %s", path)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user