mirror of
https://github.com/restic/restic.git
synced 2025-12-22 22:46:14 +00:00
List snapshots, accept snapshot id prefix
Example:
$ ./khepri snapshots
ID Date Source Directory
--------------------------------------------------------------------------------
fa31d65b 2014-11-24 19:45:11 kasimir /home/user/testdata
20bdc140 2014-11-24 20:00:47 kasimir /home/user/testdata
326cb59d 2014-11-24 20:01:40 kasimir /home/user/testdata
20ff988b 2014-11-24 20:35:35 kasimir /home/user
This commit is contained in:
@@ -19,7 +19,17 @@ func commandCat(be backend.Server, key *khepri.Key, args []string) error {
|
||||
|
||||
id, err := backend.ParseID(args[1])
|
||||
if err != nil {
|
||||
return err
|
||||
id = nil
|
||||
|
||||
if tpe != "snapshot" {
|
||||
return err
|
||||
}
|
||||
|
||||
// find snapshot id with prefix
|
||||
id, err = backend.Find(be, backend.Snapshot, args[1])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
ch, err := khepri.NewContentHandler(be, key)
|
||||
@@ -105,7 +115,8 @@ func commandCat(be backend.Server, key *khepri.Key, args []string) error {
|
||||
return nil
|
||||
case "snapshot":
|
||||
var sn khepri.Snapshot
|
||||
err := ch.LoadJSONRaw(backend.Snapshot, id, &sn)
|
||||
|
||||
err = ch.LoadJSONRaw(backend.Snapshot, id, &sn)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user