mirror of
https://github.com/restic/restic.git
synced 2026-11-09 16:36:19 +00:00
internal/restorer: invert dependency direction to ui/restorer
The restorer imported ui/restorer which leaks ui logic into the restorer core. Swap the direction by letting the restorer use a ProgressReporter interface + associated constants.
This commit is contained in:
1 parent
5cd39d01c1
commit
2f31cde517
12 files changed
+189
-116
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/restic/restic/internal/restic"
|
||||
"github.com/restic/restic/internal/restorer"
|
||||
"github.com/restic/restic/internal/ui"
|
||||
"github.com/restic/restic/internal/ui/progress"
|
||||
)
|
||||
@@ -61,24 +62,24 @@ func (t *jsonPrinter) Error(item string, err error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *jsonPrinter) CompleteItem(messageType ItemAction, item string, size uint64) {
|
||||
func (t *jsonPrinter) CompleteItem(messageType restorer.ItemAction, item string, size uint64) {
|
||||
if t.verbosity < 3 {
|
||||
return
|
||||
}
|
||||
|
||||
var action string
|
||||
switch messageType {
|
||||
case ActionDirRestored:
|
||||
case restorer.ActionDirRestored:
|
||||
action = "restored"
|
||||
case ActionFileRestored:
|
||||
case restorer.ActionFileRestored:
|
||||
action = "restored"
|
||||
case ActionOtherRestored:
|
||||
case restorer.ActionOtherRestored:
|
||||
action = "restored"
|
||||
case ActionFileUpdated:
|
||||
case restorer.ActionFileUpdated:
|
||||
action = "updated"
|
||||
case ActionFileUnchanged:
|
||||
case restorer.ActionFileUnchanged:
|
||||
action = "unchanged"
|
||||
case ActionDeleted:
|
||||
case restorer.ActionDeleted:
|
||||
action = "deleted"
|
||||
default:
|
||||
panic("unknown message type")
|
||||
|
||||
Reference in new issue
Block a user