mirror of
https://github.com/octoleo/restic.git
synced 2024-11-27 23:36:40 +00:00
read JSON/Quiet flag from the passed in globalOptions
This commit is contained in:
parent
cebce52c16
commit
4b3a0b4104
@ -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(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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})
|
||||||
|
@ -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})
|
||||||
})
|
})
|
||||||
|
@ -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))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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{})
|
||||||
|
Loading…
Reference in New Issue
Block a user