2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-24 05:37:37 +00:00

read JSON/Quiet flag from the passed in globalOptions

This commit is contained in:
Michael Eischer 2023-05-07 22:07:47 +02:00
parent cebce52c16
commit 4b3a0b4104
5 changed files with 5 additions and 5 deletions

View File

@ -594,7 +594,7 @@ func runFind(ctx context.Context, opts FindOptions, gopts GlobalOptions, args []
f := &Finder{
repo: repo,
pat: pat,
out: statefulOutput{ListLong: opts.ListLong, JSON: globalOptions.JSON},
out: statefulOutput{ListLong: opts.ListLong, JSON: gopts.JSON},
ignoreTrees: restic.NewIDSet(),
}

View File

@ -12,7 +12,7 @@ import (
func testRunFind(t testing.TB, wantJSON bool, gopts GlobalOptions, pattern string) []byte {
buf, err := withCaptureStdout(func() error {
globalOptions.JSON = wantJSON
gopts.JSON = wantJSON
opts := FindOptions{}
return runFind(context.TODO(), opts, gopts, []string{pattern})

View File

@ -10,7 +10,7 @@ import (
func testRunLs(t testing.TB, gopts GlobalOptions, snapshotID string) []string {
buf, err := withCaptureStdout(func() error {
globalOptions.Quiet = true
gopts.Quiet = true
opts := LsOptions{}
return runLs(context.TODO(), opts, gopts, []string{snapshotID})
})

View File

@ -176,7 +176,7 @@ func runRestore(ctx context.Context, opts RestoreOptions, gopts GlobalOptions,
}
var progress *restoreui.Progress
if !globalOptions.Quiet && !globalOptions.JSON {
if !gopts.Quiet && !gopts.JSON {
progress = restoreui.NewProgress(restoreui.NewProgressPrinter(term), calculateProgressInterval(!gopts.Quiet, gopts.JSON))
}

View File

@ -11,7 +11,7 @@ import (
func testRunSnapshots(t testing.TB, gopts GlobalOptions) (newest *Snapshot, snapmap map[restic.ID]Snapshot) {
buf, err := withCaptureStdout(func() error {
globalOptions.JSON = true
gopts.JSON = true
opts := SnapshotOptions{}
return runSnapshots(context.TODO(), opts, gopts, []string{})