diff --git a/src/cmds/restic/cmd_snapshots.go b/src/cmds/restic/cmd_snapshots.go index c20910614..15a18ba5e 100644 --- a/src/cmds/restic/cmd_snapshots.go +++ b/src/cmds/restic/cmd_snapshots.go @@ -38,7 +38,6 @@ func init() { f := cmdSnapshots.Flags() f.StringVar(&snapshotOptions.Host, "host", "", "only print snapshots for this host") f.StringSliceVar(&snapshotOptions.Paths, "path", []string{}, "only print snapshots for this `path` (can be specified multiple times)") - f.BoolVarP(&snapshotOptions.Json, "json", "", false, `print snapshots in json format`) } func runSnapshots(opts SnapshotOptions, gopts GlobalOptions, args []string) error { @@ -86,7 +85,7 @@ func runSnapshots(opts SnapshotOptions, gopts GlobalOptions, args []string) erro } - if opts.Json == true { + if gopts.JSON == true { jsonoutput(list) } else { naturaloutput(list) diff --git a/src/cmds/restic/global.go b/src/cmds/restic/global.go index 8757130ea..94d77dad3 100644 --- a/src/cmds/restic/global.go +++ b/src/cmds/restic/global.go @@ -31,6 +31,7 @@ type GlobalOptions struct { PasswordFile string Quiet bool NoLock bool + JSON bool password string stdout io.Writer @@ -53,6 +54,7 @@ func init() { f.StringVarP(&globalOptions.PasswordFile, "password-file", "p", "", "read the repository password from a file") f.BoolVarP(&globalOptions.Quiet, "quiet", "q", false, "do not output comprehensive progress report") f.BoolVar(&globalOptions.NoLock, "no-lock", false, "do not lock the repo, this allows some operations on read-only repos") + f.BoolVarP(&globalOptions.JSON, "json", "", false, `print snapshots in json format`) restoreTerminal() }