aboutsummaryrefslogtreecommitdiff
path: root/cmd/list.go
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2021-07-22 17:18:21 -0500
committerFurkan Sahin <furkan-dev@proton.me>2021-07-22 17:18:21 -0500
commit1dad91f7ec6e98a54a4bbb1ed9f2b13fe45b7048 (patch)
tree74a1765f26ae21ada6c313aac8ad370480f46aea /cmd/list.go
parent193128c3130d415c54380b5bc35686a72543594a (diff)
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..1e7fc34 100644
--- a/cmd/list.go
+++ b/cmd/list.go
@@ -3,13 +3,14 @@ package cmd
import (
"fmt"
"flag"
+ "golang.furkistan.com/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("")
+ }
}