added --raw option to 'blockindex show'
import (
"context"
"fmt"
+ "os"
"sort"
"time"
blockIndexShowCommand = blockIndexCommands.Command("show", "List block indexes").Alias("cat")
blockIndexShowSort = blockIndexShowCommand.Flag("sort", "Sort order").Default("offset").Enum("offset", "blockID", "size")
blockIndexShowIDs = blockIndexShowCommand.Arg("id", "IDs of index blocks to show").Required().Strings()
+ blockIndexShowRaw = blockIndexShowCommand.Flag("raw", "Show raw block data").Bool()
)
type blockIndexEntryInfo struct {
@@ -53,6 +55,9 @@ func runShowBlockIndexesAction(ctx context.Context, rep *repo.Repository) error
return fmt.Errorf("can't read block %q: %v", blockID, err)
}
+ if *blockIndexShowRaw {
+ os.Stdout.Write(data)
+ } else {
var d blockmgrpb.Indexes
if err := proto.Unmarshal(data, &d); err != nil {
return err
@@ -62,6 +67,7 @@ func runShowBlockIndexesAction(ctx context.Context, rep *repo.Repository) error
printIndexV1(ndx)
}
}
+ }
return nil
}
