From 5a8d11b85e858d989cbd43cea00b2f9587d8cbf6 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Wed, 16 Oct 2019 17:01:41 +0900 Subject: [PATCH] add format flag to chain list command --- chain/store/store.go | 5 +++-- cli/chain.go | 40 +++++++++++++++++++++++++++------------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/chain/store/store.go b/chain/store/store.go index 5148a4e64..e9b1b8b73 100644 --- a/chain/store/store.go +++ b/chain/store/store.go @@ -5,9 +5,10 @@ import ( "crypto/sha256" "encoding/json" "fmt" - "github.com/filecoin-project/go-lotus/chain/vm" "sync" + "github.com/filecoin-project/go-lotus/chain/vm" + "github.com/filecoin-project/go-lotus/build" "github.com/filecoin-project/go-lotus/chain/address" "github.com/filecoin-project/go-lotus/chain/state" @@ -271,7 +272,7 @@ func (cs *ChainStore) takeHeaviestTipSet(ts *types.TipSet) error { new: ts, } } else { - log.Warn("no heaviest tipset found, using %s", ts.Cids()) + log.Warnf("no heaviest tipset found, using %s", ts.Cids()) } log.Debugf("New heaviest tipset! %s", ts.Cids()) diff --git a/cli/chain.go b/cli/chain.go index 7e8896492..d25c9f28f 100644 --- a/cli/chain.go +++ b/cli/chain.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "strings" "time" cid "github.com/ipfs/go-cid" @@ -279,7 +280,12 @@ var chainListCmd = &cli.Command{ Usage: "View a segment of the chain", Flags: []cli.Flag{ &cli.Uint64Flag{Name: "height"}, - &cli.UintFlag{Name: "count", Value: 30}, + &cli.IntFlag{Name: "count", Value: 30}, + &cli.StringFlag{ + Name: "format", + Usage: "specify the format to print out tipsets", + Value: ": (