mirror of
https://github.com/restic/restic.git
synced 2026-10-21 00:18:12 +00:00
restore: print JSON versions of errors in --json mode
Previously, they were printed as freeform text. This also adds a ui.Terminal interface to make writing tests easier and also adds a few tests.
This commit is contained in:
1 parent
ad2585af67
commit
a376323331
17 files changed
+234
-70
No files matched your search
@@ -7,14 +7,13 @@ import (
|
||||
"github.com/restic/restic/internal/archiver"
|
||||
"github.com/restic/restic/internal/restic"
|
||||
"github.com/restic/restic/internal/ui"
|
||||
"github.com/restic/restic/internal/ui/termstatus"
|
||||
)
|
||||
|
||||
// JSONProgress reports progress for the `backup` command in JSON.
|
||||
type JSONProgress struct {
|
||||
*ui.Message
|
||||
|
||||
term *termstatus.Terminal
|
||||
term ui.Terminal
|
||||
v uint
|
||||
}
|
||||
|
||||
@@ -22,7 +21,7 @@ type JSONProgress struct {
|
||||
var _ ProgressPrinter = &JSONProgress{}
|
||||
|
||||
// NewJSONProgress returns a new backup progress reporter.
|
||||
func NewJSONProgress(term *termstatus.Terminal, verbosity uint) *JSONProgress {
|
||||
func NewJSONProgress(term ui.Terminal, verbosity uint) *JSONProgress {
|
||||
return &JSONProgress{
|
||||
Message: ui.NewMessage(term, verbosity),
|
||||
term: term,
|
||||
|
||||
Reference in new issue
Block a user