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{ f := &Finder{
repo: repo, repo: repo,
pat: pat, pat: pat,
out: statefulOutput{ListLong: opts.ListLong, JSON: globalOptions.JSON}, out: statefulOutput{ListLong: opts.ListLong, JSON: gopts.JSON},
ignoreTrees: restic.NewIDSet(), ignoreTrees: restic.NewIDSet(),
} }

View File

@ -12,7 +12,7 @@ import (
func testRunFind(t testing.TB, wantJSON bool, gopts GlobalOptions, pattern string) []byte { func testRunFind(t testing.TB, wantJSON bool, gopts GlobalOptions, pattern string) []byte {
buf, err := withCaptureStdout(func() error { buf, err := withCaptureStdout(func() error {
globalOptions.JSON = wantJSON gopts.JSON = wantJSON
opts := FindOptions{} opts := FindOptions{}
return runFind(context.TODO(), opts, gopts, []string{pattern}) 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 { func testRunLs(t testing.TB, gopts GlobalOptions, snapshotID string) []string {
buf, err := withCaptureStdout(func() error { buf, err := withCaptureStdout(func() error {
globalOptions.Quiet = true gopts.Quiet = true
opts := LsOptions{} opts := LsOptions{}
return runLs(context.TODO(), opts, gopts, []string{snapshotID}) 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 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)) 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) { func testRunSnapshots(t testing.TB, gopts GlobalOptions) (newest *Snapshot, snapmap map[restic.ID]Snapshot) {
buf, err := withCaptureStdout(func() error { buf, err := withCaptureStdout(func() error {
globalOptions.JSON = true gopts.JSON = true
opts := SnapshotOptions{} opts := SnapshotOptions{}
return runSnapshots(context.TODO(), opts, gopts, []string{}) return runSnapshots(context.TODO(), opts, gopts, []string{})