aboutsummaryrefslogtreecommitdiff
path: root/repo.go
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-09-27 19:55:57 +0200
committern-peugnet <n.peugnet@free.fr>2021-09-27 19:55:57 +0200
commit53640f33362d8d6dc65db403e3b31a6776b49796 (patch)
treef18c69aafc8b614978e4c5d9e10a987240eff5a0 /repo.go
parentccb97e0bb5fb0e0c257411d442183d49dd734822 (diff)
downloaddna-backup-53640f33362d8d6dc65db403e3b31a6776b49796.tar.gz
dna-backup-53640f33362d8d6dc65db403e3b31a6776b49796.zip
add CLI with subcommands
Diffstat (limited to 'repo.go')
-rw-r--r--repo.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/repo.go b/repo.go
index 06524aa..d781b16 100644
--- a/repo.go
+++ b/repo.go
@@ -182,9 +182,12 @@ func (r *Repo) Commit(source string) {
func (r *Repo) Restore(destination string) {
versions := r.loadVersions()
+ logger.Info("loading previous file lists")
r.loadFileLists(versions)
+ logger.Info("loading previous recipies")
r.loadRecipes(versions)
reader, writer := io.Pipe()
+ logger.Info("restoring latest version")
go r.restoreStream(writer, r.recipe)
bufReader := bufio.NewReaderSize(reader, r.chunkSize*2)
for _, file := range r.files {
@@ -353,7 +356,7 @@ func fileList2slice(l []File) (ret slice.Slice) {
}
func slice2fileList(s slice.Slice) (ret []File) {
- ret = make([]File, len(s), len(s))
+ ret = make([]File, len(s))
for i := range s {
if f, ok := s[i].(File); ok {
ret[i] = f
@@ -721,7 +724,7 @@ func recipe2slice(r []Chunk) (ret slice.Slice) {
}
func slice2recipe(s slice.Slice) (ret []Chunk) {
- ret = make([]Chunk, len(s), len(s))
+ ret = make([]Chunk, len(s))
for i := range s {
if c, ok := s[i].(Chunk); ok {
ret[i] = c