2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-16 07:42:22 +00:00
restic/cmd/khepri/cmd_list.go

30 lines
433 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])
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
}