From d9a71b136180318e1c6fe53199a63a73935b6ae7 Mon Sep 17 00:00:00 2001 From: nbsp Date: Wed, 8 Jan 2025 05:46:32 +0200 Subject: [PATCH] backup restoring --- app/backups.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/backups.go b/app/backups.go index 6b2db64..86f4e52 100644 --- a/app/backups.go +++ b/app/backups.go @@ -3,6 +3,8 @@ package app import ( "io/fs" "os" + "os/exec" + "path" "strconv" "time" @@ -29,6 +31,7 @@ func NewBackups() *Backups { if err != nil { continue } + // XXX: for some reason this gets fucked up with timezones??? list = append(list, humanize.Time(timestamp.Local())) } @@ -71,6 +74,8 @@ func (backups *Backups) Event(state *ui.State, event vaxis.Event) (processed boo } func (backups *Backups) Draw(state *ui.State) { + exec.Command("tar", "-C", ttbp.PathUserEntries, "-xf", path.Join(ttbp.PathUserBackups, backups.backups[backups.list.Index()].Name()), "--strip-components=1", "--skip-old-files").Run() + win := state.Window() win.New(win.Width/2-10, win.Height/2-8, 20, 5).Print(vaxis.Segment{Text: backups.title}) win.New(win.Width/2-13, win.Height/2-2, 26, 1).Print(vaxis.Segment{Text: backups.description})