mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 02:48:55 +00:00
Optimize 'cat' and 'snapshots' commands
This commit is contained in:
parent
5eaa427e80
commit
0e1045301a
@ -58,13 +58,13 @@ func (cmd CmdCat) Execute(args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
err = ch.LoadAllMaps()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
switch tpe {
|
||||
case "blob":
|
||||
err = ch.LoadAllMaps()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// try id
|
||||
data, err := ch.Load(backend.Data, id)
|
||||
if err == nil {
|
||||
@ -88,6 +88,11 @@ func (cmd CmdCat) Execute(args []string) error {
|
||||
return err
|
||||
|
||||
case "tree":
|
||||
err = ch.LoadAllMaps()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var tree restic.Tree
|
||||
// try id
|
||||
err := ch.LoadJSON(backend.Tree, id, &tree)
|
||||
|
@ -108,7 +108,7 @@ func (cmd CmdSnapshots) Execute(args []string) error {
|
||||
|
||||
list := []*restic.Snapshot{}
|
||||
backend.EachID(be, backend.Snapshot, func(id backend.ID) {
|
||||
sn, err := ch.LoadSnapshot(id)
|
||||
sn, err := restic.LoadSnapshot(ch, id)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error loading snapshot %s: %v\n", id, err)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user