From 2231e04e2b50c536780d51364a332f23df3a9221 Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 10 Oct 2013 13:51:20 -0400 Subject: [PATCH] improve showblock by setting default datadir and requiring -s --- util/showblock/showblock.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/util/showblock/showblock.go b/util/showblock/showblock.go index 2ce8f105..806cb141 100644 --- a/util/showblock/showblock.go +++ b/util/showblock/showblock.go @@ -29,7 +29,7 @@ type config struct { TestNet3 bool `long:"testnet" description:"Use the test network"` OutFile string `short:"o" description:"outfile"` Progress bool `short:"p" description:"show progress"` - ShaString string `short:"s" description:"Block SHA to process"` + ShaString string `short:"s" description:"Block SHA to process" required:"true"` EShaString string `short:"e" description:"End Block SHA to process"` RawBlock bool `short:"r" description:"Raw Block"` FmtBlock bool `short:"f" description:"Format Block"` @@ -46,7 +46,10 @@ const ( func main() { end := int64(-1) - cfg := config{DbType: "leveldb"} + cfg := config{ + DbType: "leveldb", + DataDir: filepath.Join(btcdHomeDir(), "data"), + } parser := flags.NewParser(&cfg, flags.Default) _, err := parser.Parse() if err != nil { @@ -65,9 +68,6 @@ func main() { defer log.Flush() btcdb.UseLogger(log) - if len(cfg.DataDir) == 0 { - cfg.DataDir = filepath.Join(btcdHomeDir(), "data") - } var testnet string if cfg.TestNet3 { testnet = "testnet"