forked from TrueCloudLab/restic
Move FindSnapshot, make Repository.List() return IDs
This commit is contained in:
parent
cf37b619fd
commit
6e38a8a033
12 changed files with 75 additions and 97 deletions
12
snapshot.go
12
snapshot.go
|
@ -89,3 +89,15 @@ func (sn *Snapshot) fillUserInfo() error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
// FindSnapshot takes a string and tries to find a snapshot whose ID matches
|
||||
// the string as closely as possible.
|
||||
func FindSnapshot(repo *repository.Repository, s string) (backend.ID, error) {
|
||||
// find snapshot id with prefix
|
||||
name, err := backend.Find(repo.Backend(), backend.Snapshot, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return backend.ParseID(name)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue