From d7f52fd7e5e6705ef957dc60c32b6bfdaf2a03cd Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Mon, 30 Jan 2017 10:28:17 +0100 Subject: [PATCH] Allow listing blobs Closes #756 --- src/cmds/restic/cmd_list.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/cmds/restic/cmd_list.go b/src/cmds/restic/cmd_list.go index a37de8d9e..561943af2 100644 --- a/src/cmds/restic/cmd_list.go +++ b/src/cmds/restic/cmd_list.go @@ -1,8 +1,10 @@ package main import ( + "fmt" "restic" "restic/errors" + "restic/index" "github.com/spf13/cobra" ) @@ -52,6 +54,19 @@ func runList(opts GlobalOptions, args []string) error { t = restic.KeyFile case "locks": t = restic.LockFile + case "blobs": + idx, err := index.Load(repo, nil) + if err != nil { + return err + } + + for _, pack := range idx.Packs { + for _, entry := range pack.Entries { + fmt.Printf("%v %v\n", entry.Type, entry.ID) + } + } + + return nil default: return errors.Fatal("invalid type") }