From d19a29f79e2ce5f72086c8a9baa65a964385998c Mon Sep 17 00:00:00 2001 From: David Brown Date: Sat, 23 Feb 2019 09:38:33 -0700 Subject: [PATCH] Include reasons in json output of forget This dumps the reasons as well as the list of keeps and removes with the output from the forget command. --- cmd/restic/cmd_forget.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/restic/cmd_forget.go b/cmd/restic/cmd_forget.go index 397b41915..a9b7246be 100644 --- a/cmd/restic/cmd_forget.go +++ b/cmd/restic/cmd_forget.go @@ -236,6 +236,8 @@ func runForget(opts ForgetOptions, gopts GlobalOptions, args []string) error { } addJSONSnapshots(&fg.Remove, remove) + fg.Reasons = reasons + jsonGroups = append(jsonGroups, &fg) removeSnapshots += len(remove) @@ -271,11 +273,12 @@ func runForget(opts ForgetOptions, gopts GlobalOptions, args []string) error { // ForgetGroup helps to print what is forgotten in JSON. type ForgetGroup struct { - Tags []string `json:"tags"` - Host string `json:"host"` - Paths []string `json:"paths"` - Keep []Snapshot `json:"keep"` - Remove []Snapshot `json:"remove"` + Tags []string `json:"tags"` + Host string `json:"host"` + Paths []string `json:"paths"` + Keep []Snapshot `json:"keep"` + Remove []Snapshot `json:"remove"` + Reasons []restic.KeepReason `json:"reasons"` } func addJSONSnapshots(js *[]Snapshot, list restic.Snapshots) {