2
2
mirror of https://github.com/octoleo/restic.git synced 2024-05-28 22:50:48 +00:00
restic/cmd/khepri/cmd_list.go
2014-08-01 22:20:28 +02:00

30 lines
436 B
Go

package main
import (
"errors"
"fmt"
"os"
"github.com/fd0/khepri"
)
func commandList(repo *khepri.DirRepository, args []string) error {
if len(args) != 1 {
return errors.New("usage: list [blob|ref]")
}
tpe := khepri.NewTypeFromString(args[0])
ids, err := repo.ListIDs(tpe)
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
return nil
}
for _, id := range ids {
fmt.Printf("%v\n", id)
}
return nil
}