2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-12 13:52:22 +00:00

snapshots: Add short ID to JSON output

We're using the short ID in all output to users, so it should also be
included in the JSON output of the `snapshots` command.
This commit is contained in:
Alexander Neumann 2017-10-03 15:24:09 +02:00
parent 2694def56a
commit 657a1d75af

View File

@ -173,6 +173,7 @@ type Snapshot struct {
*restic.Snapshot
ID *restic.ID `json:"id"`
ShortID string `json:"short_id"`
}
// printSnapshotsJSON writes the JSON representation of list to stdout.
@ -185,6 +186,7 @@ func printSnapshotsJSON(stdout io.Writer, list restic.Snapshots) error {
k := Snapshot{
Snapshot: sn,
ID: sn.ID(),
ShortID: sn.ID().Str(),
}
snapshots = append(snapshots, k)
}