forked from TrueCloudLab/restic
debug: get stdout/stderr from gopts/globalOptions
This commit is contained in:
parent
08bf3bae79
commit
7aa2f8a61e
1 changed files with 6 additions and 7 deletions
|
@ -7,7 +7,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
@ -90,7 +89,7 @@ func printPacks(repo *repository.Repository, wr io.Writer) error {
|
||||||
|
|
||||||
blobs, err := pack.List(repo.Key(), restic.ReaderAt(repo.Backend(), h), size)
|
blobs, err := pack.List(repo.Key(), restic.ReaderAt(repo.Backend(), h), size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "error for pack %v: %v\n", id.Str(), err)
|
fmt.Fprintf(globalOptions.stderr, "error for pack %v: %v\n", id.Str(), err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,20 +150,20 @@ func runDebugDump(gopts GlobalOptions, args []string) error {
|
||||||
|
|
||||||
switch tpe {
|
switch tpe {
|
||||||
case "indexes":
|
case "indexes":
|
||||||
return dumpIndexes(repo, os.Stdout)
|
return dumpIndexes(repo, gopts.stdout)
|
||||||
case "snapshots":
|
case "snapshots":
|
||||||
return debugPrintSnapshots(repo, os.Stdout)
|
return debugPrintSnapshots(repo, gopts.stdout)
|
||||||
case "packs":
|
case "packs":
|
||||||
return printPacks(repo, os.Stdout)
|
return printPacks(repo, gopts.stdout)
|
||||||
case "all":
|
case "all":
|
||||||
fmt.Printf("snapshots:\n")
|
fmt.Printf("snapshots:\n")
|
||||||
err := debugPrintSnapshots(repo, os.Stdout)
|
err := debugPrintSnapshots(repo, gopts.stdout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("\nindexes:\n")
|
fmt.Printf("\nindexes:\n")
|
||||||
err = dumpIndexes(repo, os.Stdout)
|
err = dumpIndexes(repo, gopts.stdout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue