mirror of
https://github.com/restic/restic.git
synced 2025-12-12 06:51:51 +00:00
restorer: only show size in text output for files
This commit is contained in:
@@ -52,6 +52,8 @@ func (t *jsonPrinter) CompleteItem(messageType ItemAction, item string, size uin
|
||||
action = "restored"
|
||||
case ActionFileRestored:
|
||||
action = "restored"
|
||||
case ActionOtherRestored:
|
||||
action = "restored"
|
||||
case ActionFileUpdated:
|
||||
action = "updated"
|
||||
case ActionFileUnchanged:
|
||||
|
||||
@@ -51,6 +51,7 @@ const (
|
||||
ActionFileRestored ItemAction = "file restored"
|
||||
ActionFileUpdated ItemAction = "file updated"
|
||||
ActionFileUnchanged ItemAction = "file unchanged"
|
||||
ActionOtherRestored ItemAction = "other restored"
|
||||
ActionDeleted ItemAction = "deleted"
|
||||
)
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ func (t *textPrinter) CompleteItem(messageType ItemAction, item string, size uin
|
||||
action = "restored"
|
||||
case ActionFileRestored:
|
||||
action = "restored"
|
||||
case ActionOtherRestored:
|
||||
action = "restored"
|
||||
case ActionFileUpdated:
|
||||
action = "updated"
|
||||
case ActionFileUnchanged:
|
||||
@@ -54,7 +56,7 @@ func (t *textPrinter) CompleteItem(messageType ItemAction, item string, size uin
|
||||
panic("unknown message type")
|
||||
}
|
||||
|
||||
if messageType == ActionDirRestored || messageType == ActionDeleted {
|
||||
if messageType == ActionDirRestored || messageType == ActionOtherRestored || messageType == ActionDeleted {
|
||||
t.terminal.Print(fmt.Sprintf("%-9v %v", action, item))
|
||||
} else {
|
||||
t.terminal.Print(fmt.Sprintf("%-9v %v with size %v", action, item, ui.FormatBytes(size)))
|
||||
|
||||
@@ -63,6 +63,7 @@ func TestPrintCompleteItem(t *testing.T) {
|
||||
}{
|
||||
{ActionDirRestored, 0, "restored test"},
|
||||
{ActionFileRestored, 123, "restored test with size 123 B"},
|
||||
{ActionOtherRestored, 0, "restored test"},
|
||||
{ActionFileUpdated, 123, "updated test with size 123 B"},
|
||||
{ActionFileUnchanged, 123, "unchanged test with size 123 B"},
|
||||
{ActionDeleted, 0, "deleted test"},
|
||||
|
||||
Reference in New Issue
Block a user