2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-10 23:31:09 +00:00
restic/cmd/khepri/cmd_list.go

30 lines
430 B
Go
Raw Normal View History

2014-08-01 20:20:28 +00:00
package main
import (
"errors"
"fmt"
"os"
"github.com/fd0/khepri"
)
2014-08-04 18:47:04 +00:00
func commandList(repo *khepri.Repository, args []string) error {
2014-08-01 20:20:28 +00:00
if len(args) != 1 {
return errors.New("usage: list [blob|ref]")
}
tpe := khepri.NewTypeFromString(args[0])
2014-08-04 20:15:04 +00:00
ids, err := repo.List(tpe)
2014-08-01 20:20:28 +00:00
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
return nil
}
for _, id := range ids {
fmt.Printf("%v\n", id)
}
return nil
}