diff --git a/src/cmds/restic/cmd_snapshots.go b/src/cmds/restic/cmd_snapshots.go index 6195ffb0a..74a7c1263 100644 --- a/src/cmds/restic/cmd_snapshots.go +++ b/src/cmds/restic/cmd_snapshots.go @@ -57,8 +57,8 @@ func runSnapshots(opts SnapshotOptions, gopts GlobalOptions, args []string) erro } tab := NewTable() - tab.Header = fmt.Sprintf("%-8s %-19s %-10s %-10s %s", "ID", "Date", "Host", "Tags", "Directory") - tab.RowFormat = "%-8s %-19s %-10s %-10s %s" + tab.Header = fmt.Sprintf("%-8s %-19s %-10s %-10s %-3s %s", "ID", "Date", "Host", "Tags", "", "Directory") + tab.RowFormat = "%-8s %-19s %-10s %-10s %-3s %s" done := make(chan struct{}) defer close(done) @@ -97,9 +97,15 @@ func runSnapshots(opts SnapshotOptions, gopts GlobalOptions, args []string) erro firstTag = sn.Tags[0] } - tab.Rows = append(tab.Rows, []interface{}{sn.ID().Str(), sn.Time.Format(TimeFormat), sn.Hostname, firstTag, sn.Paths[0]}) - rows := len(sn.Paths) + + treeElement := " " + if rows != 1 { + treeElement = "┌──" + } + + tab.Rows = append(tab.Rows, []interface{}{sn.ID().Str(), sn.Time.Format(TimeFormat), sn.Hostname, firstTag, treeElement, sn.Paths[0]}) + if len(sn.Tags) > rows { rows = len(sn.Tags) } @@ -115,7 +121,12 @@ func runSnapshots(opts SnapshotOptions, gopts GlobalOptions, args []string) erro tag = sn.Tags[i] } - tab.Rows = append(tab.Rows, []interface{}{"", "", "", tag, path}) + treeElement := "│" + if i == (rows - 1) { + treeElement = "└──" + } + + tab.Rows = append(tab.Rows, []interface{}{"", "", "", tag, treeElement, path}) } }