mirror of
https://github.com/restic/restic.git
synced 2025-12-13 12:02:59 +00:00
snapshots: Make --json output [] instead of null when no snapshots
This commit is contained in:
@@ -298,7 +298,7 @@ type SnapshotGroup struct {
|
||||
// printSnapshotsJSON writes the JSON representation of list to stdout.
|
||||
func printSnapshotGroupJSON(stdout io.Writer, snGroups map[string]restic.Snapshots, grouped bool) error {
|
||||
if grouped {
|
||||
var snapshotGroups []SnapshotGroup
|
||||
snapshotGroups := []SnapshotGroup{}
|
||||
|
||||
for k, list := range snGroups {
|
||||
var key restic.SnapshotGroupKey
|
||||
@@ -330,7 +330,7 @@ func printSnapshotGroupJSON(stdout io.Writer, snGroups map[string]restic.Snapsho
|
||||
}
|
||||
|
||||
// Old behavior
|
||||
var snapshots []Snapshot
|
||||
snapshots := []Snapshot{}
|
||||
|
||||
for _, list := range snGroups {
|
||||
for _, sn := range list {
|
||||
|
||||
Reference in New Issue
Block a user