From 4b3a0b41046e873f9f08ae6e3dbb2f0414344331 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sun, 7 May 2023 22:07:47 +0200 Subject: [PATCH] read JSON/Quiet flag from the passed in globalOptions --- cmd/restic/cmd_find.go | 2 +- cmd/restic/cmd_find_integration_test.go | 2 +- cmd/restic/cmd_ls_integration_test.go | 2 +- cmd/restic/cmd_restore.go | 2 +- cmd/restic/cmd_snapshots_integration_test.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/restic/cmd_find.go b/cmd/restic/cmd_find.go index 1fa597afd..6b5e32df7 100644 --- a/cmd/restic/cmd_find.go +++ b/cmd/restic/cmd_find.go @@ -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(), } diff --git a/cmd/restic/cmd_find_integration_test.go b/cmd/restic/cmd_find_integration_test.go index 236721154..dd8ab87fd 100644 --- a/cmd/restic/cmd_find_integration_test.go +++ b/cmd/restic/cmd_find_integration_test.go @@ -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}) diff --git a/cmd/restic/cmd_ls_integration_test.go b/cmd/restic/cmd_ls_integration_test.go index a93092f58..39bf9c3b0 100644 --- a/cmd/restic/cmd_ls_integration_test.go +++ b/cmd/restic/cmd_ls_integration_test.go @@ -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}) }) diff --git a/cmd/restic/cmd_restore.go b/cmd/restic/cmd_restore.go index 732a942b2..a0d4ce3e4 100644 --- a/cmd/restic/cmd_restore.go +++ b/cmd/restic/cmd_restore.go @@ -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)) } diff --git a/cmd/restic/cmd_snapshots_integration_test.go b/cmd/restic/cmd_snapshots_integration_test.go index ba284a9e9..6eaa8faa4 100644 --- a/cmd/restic/cmd_snapshots_integration_test.go +++ b/cmd/restic/cmd_snapshots_integration_test.go @@ -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{})