From 34d7d612dd376258248ee6cae07b839951fccf32 Mon Sep 17 00:00:00 2001 From: flu0r1ne Date: Thu, 22 Jul 2021 17:18:21 -0500 Subject: List command, diff command, and snapshot search infrastructure --- cmd/list.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'cmd/list.go') 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("") + } } -- cgit v1.2.3