aboutsummaryrefslogtreecommitdiff
path: root/cmd/list.go
diff options
context:
space:
mode:
authorflu0r1ne <flu0r1ne@flu0r1ne.net>2021-07-22 17:18:21 -0500
committerflu0r1ne <flu0r1ne@flu0r1ne.net>2021-07-22 17:18:21 -0500
commit34d7d612dd376258248ee6cae07b839951fccf32 (patch)
tree6d637a04f5cbbd285c89331a3b9fb58b5e605e52 /cmd/list.go
parentaf8f52e2e4c879935656dd93c2fb564c6e2ce515 (diff)
downloadzsu-34d7d612dd376258248ee6cae07b839951fccf32.tar.xz
zsu-34d7d612dd376258248ee6cae07b839951fccf32.zip
List command, diff command, and snapshot search infrastructure
Diffstat (limited to 'cmd/list.go')
-rw-r--r--cmd/list.go20
1 files changed, 17 insertions, 3 deletions
diff --git a/cmd/list.go b/cmd/list.go
index 99d5f24..5849975 100644
--- a/cmd/list.go
+++ b/cmd/list.go
@@ -3,13 +3,14 @@ package cmd
import (
"fmt"
"flag"
+ "golang.flu0r1ne.net/zfdiff/snap"
)
func List(params []string) {
flags := flag.NewFlagSet("list", flag.ExitOnError)
var withPaths bool
-
+
withName := aliasedBoolVar(
flags,
&withPaths,
@@ -32,6 +33,19 @@ func List(params []string) {
reference := flags.Arg(0)
- fmt.Printf(reference)
- fmt.Printf("Your flag is: %t", withPaths);
+ snaps := snap.GetTimeseries(reference)
+
+ for _, s := range snaps {
+ if s.Reference == "" {
+ continue
+ }
+
+ fmt.Printf("%s", s.Name)
+
+ if withPaths {
+ fmt.Printf(", %s", s.Reference)
+ }
+
+ fmt.Println("")
+ }
}