2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-27 20:45:19 +00:00

Merge pull request #1320 from restic/add-snapshots-json-short-id

snapshots: Add short ID to JSON output
This commit is contained in:
Alexander Neumann 2017-10-03 18:53:17 +02:00
commit 79f63a2e74

View File

@ -172,7 +172,8 @@ func PrintSnapshots(stdout io.Writer, list restic.Snapshots, compact bool) {
type Snapshot struct {
*restic.Snapshot
ID *restic.ID `json:"id"`
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)
}