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:
Michael Terry
2024-08-03 15:18:46 -04:00
parent ad2585af67
commit a376323331
17 changed files with 234 additions and 70 deletions
+2 -4
View File
@@ -2,19 +2,17 @@ package ui
import (
"fmt"
"github.com/restic/restic/internal/ui/termstatus"
)
// Message reports progress with messages of different verbosity.
type Message struct {
term *termstatus.Terminal
term Terminal
v uint
}
// NewMessage returns a message progress reporter with underlying terminal
// term.
func NewMessage(term *termstatus.Terminal, verbosity uint) *Message {
func NewMessage(term Terminal, verbosity uint) *Message {
return &Message{
term: term,
v: verbosity,