package cmd import ( "fmt" "flag" "golang.flu0r1ne.net/zsu/snap" ) func List(params []string) { flags := flag.NewFlagSet("list", flag.ExitOnError) var withPaths bool withName := aliasedBoolVar( flags, &withPaths, false, "print paths to the provided reference within the snapshot", ) withName("paths") withName("p") flags.Parse(params); if(flags.NArg() == 0) { die.Fatal("Reference file is required") } if(flags.NArg() > 1) { die.Fatal("Too many arguments provided") } reference := flags.Arg(0) 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("") } }