added new cli flags to 'storage list'
var (
storageListCommand = storageCommands.Command("list", "List storage blocks").Alias("ls")
storageListPrefix = storageListCommand.Flag("prefix", "Block prefix").String()
+ storageListMinSize = storageListCommand.Flag("min-size", "Minimum size").Int64()
+ storageListMaxSize = storageListCommand.Flag("max-size", "Maximum size").Int64()
)
func runListStorageBlocks(ctx context.Context, rep *repo.Repository) error {
@@ -22,6 +24,14 @@ func runListStorageBlocks(ctx context.Context, rep *repo.Repository) error {
return b.Error
}
+ if *storageListMaxSize != 0 && b.Length > *storageListMaxSize {
+ continue
+ }
+
+ if *storageListMinSize != 0 && b.Length < *storageListMinSize {
+ continue
+ }
+
fmt.Printf("%-70v %10v %v\n", b.BlockID, b.Length, b.TimeStamp.Local().Format(timeFormat))
}
