mirror of
https://github.com/octoleo/restic.git
synced 2024-11-30 08:44:02 +00:00
restorer: only show size in text output for files
This commit is contained in:
parent
4f4598a1e3
commit
59c880fce3
@ -278,7 +278,7 @@ func (res *Restorer) restoreNodeTo(ctx context.Context, node *restic.Node, targe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res.opts.Progress.AddProgress(location, restoreui.ActionFileRestored, 0, 0)
|
res.opts.Progress.AddProgress(location, restoreui.ActionOtherRestored, 0, 0)
|
||||||
return res.restoreNodeMetadataTo(node, target, location)
|
return res.restoreNodeMetadataTo(node, target, location)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ func (res *Restorer) restoreHardlinkAt(node *restic.Node, target, path, location
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res.opts.Progress.AddProgress(location, restoreui.ActionFileRestored, 0, 0)
|
res.opts.Progress.AddProgress(location, restoreui.ActionOtherRestored, 0, 0)
|
||||||
// TODO investigate if hardlinks have separate metadata on any supported system
|
// TODO investigate if hardlinks have separate metadata on any supported system
|
||||||
return res.restoreNodeMetadataTo(node, path, location)
|
return res.restoreNodeMetadataTo(node, path, location)
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,8 @@ func (t *jsonPrinter) CompleteItem(messageType ItemAction, item string, size uin
|
|||||||
action = "restored"
|
action = "restored"
|
||||||
case ActionFileRestored:
|
case ActionFileRestored:
|
||||||
action = "restored"
|
action = "restored"
|
||||||
|
case ActionOtherRestored:
|
||||||
|
action = "restored"
|
||||||
case ActionFileUpdated:
|
case ActionFileUpdated:
|
||||||
action = "updated"
|
action = "updated"
|
||||||
case ActionFileUnchanged:
|
case ActionFileUnchanged:
|
||||||
|
@ -51,6 +51,7 @@ const (
|
|||||||
ActionFileRestored ItemAction = "file restored"
|
ActionFileRestored ItemAction = "file restored"
|
||||||
ActionFileUpdated ItemAction = "file updated"
|
ActionFileUpdated ItemAction = "file updated"
|
||||||
ActionFileUnchanged ItemAction = "file unchanged"
|
ActionFileUnchanged ItemAction = "file unchanged"
|
||||||
|
ActionOtherRestored ItemAction = "other restored"
|
||||||
ActionDeleted ItemAction = "deleted"
|
ActionDeleted ItemAction = "deleted"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -44,6 +44,8 @@ func (t *textPrinter) CompleteItem(messageType ItemAction, item string, size uin
|
|||||||
action = "restored"
|
action = "restored"
|
||||||
case ActionFileRestored:
|
case ActionFileRestored:
|
||||||
action = "restored"
|
action = "restored"
|
||||||
|
case ActionOtherRestored:
|
||||||
|
action = "restored"
|
||||||
case ActionFileUpdated:
|
case ActionFileUpdated:
|
||||||
action = "updated"
|
action = "updated"
|
||||||
case ActionFileUnchanged:
|
case ActionFileUnchanged:
|
||||||
@ -54,7 +56,7 @@ func (t *textPrinter) CompleteItem(messageType ItemAction, item string, size uin
|
|||||||
panic("unknown message type")
|
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))
|
t.terminal.Print(fmt.Sprintf("%-9v %v", action, item))
|
||||||
} else {
|
} else {
|
||||||
t.terminal.Print(fmt.Sprintf("%-9v %v with size %v", action, item, ui.FormatBytes(size)))
|
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"},
|
{ActionDirRestored, 0, "restored test"},
|
||||||
{ActionFileRestored, 123, "restored test with size 123 B"},
|
{ActionFileRestored, 123, "restored test with size 123 B"},
|
||||||
|
{ActionOtherRestored, 0, "restored test"},
|
||||||
{ActionFileUpdated, 123, "updated test with size 123 B"},
|
{ActionFileUpdated, 123, "updated test with size 123 B"},
|
||||||
{ActionFileUnchanged, 123, "unchanged test with size 123 B"},
|
{ActionFileUnchanged, 123, "unchanged test with size 123 B"},
|
||||||
{ActionDeleted, 0, "deleted test"},
|
{ActionDeleted, 0, "deleted test"},
|
||||||
|
Loading…
Reference in New Issue
Block a user