From 02c5e9067135e356fe4cf90a416c8d6c8bab2b5b Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Sat, 2 Jun 2018 10:46:59 -0700 Subject: [PATCH] added new cli flags to 'storage list' --- cli/command_storage_list.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cli/command_storage_list.go b/cli/command_storage_list.go index 895fd0f7c..59c6088cc 100644 --- a/cli/command_storage_list.go +++ b/cli/command_storage_list.go @@ -10,6 +10,8 @@ import ( 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)) }