mirror of
https://github.com/restic/restic.git
synced 2026-11-10 08:41:00 +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
@@ -0,0 +1,22 @@
|
||||
package ui
|
||||
|
||||
type MockTerminal struct {
|
||||
Output []string
|
||||
Errors []string
|
||||
}
|
||||
|
||||
func (m *MockTerminal) Print(line string) {
|
||||
m.Output = append(m.Output, line)
|
||||
}
|
||||
|
||||
func (m *MockTerminal) Error(line string) {
|
||||
m.Errors = append(m.Errors, line)
|
||||
}
|
||||
|
||||
func (m *MockTerminal) SetStatus(lines []string) {
|
||||
m.Output = append([]string{}, lines...)
|
||||
}
|
||||
|
||||
func (m *MockTerminal) CanUpdateStatus() bool {
|
||||
return true
|
||||
}
|
||||
Reference in new issue
Block a user