mirror of
https://github.com/restic/restic.git
synced 2025-12-12 03:22:07 +00:00
restore: print processed files at maximum verbosity
This commit is contained in:
@@ -8,12 +8,14 @@ import (
|
||||
)
|
||||
|
||||
type textPrinter struct {
|
||||
terminal term
|
||||
terminal term
|
||||
verbosity uint
|
||||
}
|
||||
|
||||
func NewTextProgress(terminal term) ProgressPrinter {
|
||||
func NewTextProgress(terminal term, verbosity uint) ProgressPrinter {
|
||||
return &textPrinter{
|
||||
terminal: terminal,
|
||||
terminal: terminal,
|
||||
verbosity: verbosity,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +33,32 @@ func (t *textPrinter) Update(p State, duration time.Duration) {
|
||||
t.terminal.SetStatus([]string{progress})
|
||||
}
|
||||
|
||||
func (t *textPrinter) CompleteItem(messageType ItemAction, item string, size uint64) {
|
||||
if t.verbosity < 3 {
|
||||
return
|
||||
}
|
||||
|
||||
var action string
|
||||
switch messageType {
|
||||
case ActionDirRestored:
|
||||
action = "restored"
|
||||
case ActionFileRestored:
|
||||
action = "restored"
|
||||
case ActionFileUpdated:
|
||||
action = "updated"
|
||||
case ActionFileUnchanged:
|
||||
action = "unchanged"
|
||||
default:
|
||||
panic("unknown message type")
|
||||
}
|
||||
|
||||
if messageType == ActionDirRestored {
|
||||
t.terminal.Print(fmt.Sprintf("restored %v", item))
|
||||
} else {
|
||||
t.terminal.Print(fmt.Sprintf("%-9v %v with size %v", action, item, ui.FormatBytes(size)))
|
||||
}
|
||||
}
|
||||
|
||||
func (t *textPrinter) Finish(p State, duration time.Duration) {
|
||||
t.terminal.SetStatus([]string{})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user