From 21cbf8c76aeda1c28b637700483b6a927cd63cbb Mon Sep 17 00:00:00 2001 From: Thomas Bruyelle Date: Wed, 20 Mar 2024 18:04:04 +0100 Subject: [PATCH] fix: print table in markdown format --- distribution.go | 3 +++ testdata/distribution.golden | 9 +++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/distribution.go b/distribution.go index 9a7b5a5..8726f02 100644 --- a/distribution.go +++ b/distribution.go @@ -204,6 +204,8 @@ func (m voteMap) toPercentages() map[govtypes.VoteOption]sdk.Dec { func printAirdropStats(airdrop airdrop) { printDistrib := func(d distrib) { table := tablewriter.NewWriter(os.Stdout) + table.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false}) + table.SetCenterSeparator("|") table.SetHeader([]string{"", "TOTAL", "DID NOT VOTE", "YES", "NO", "NOWITHVETO", "ABSTAIN", "NOT STAKED"}) table.Append([]string{ "Distributed", @@ -229,6 +231,7 @@ func printAirdropStats(airdrop airdrop) { } fmt.Println("$ATOM distribution") printDistrib(airdrop.atom) + fmt.Println() fmt.Printf("$ATONE distribution (ratio: x%.3f, blend: %.3f, IcfSlash: %s $ATOM)\n", airdrop.atone.supply.Quo(airdrop.atom.supply).MustFloat64(), airdrop.blend.MustFloat64(), diff --git a/testdata/distribution.golden b/testdata/distribution.golden index 4a877ce..e7bf19d 100644 --- a/testdata/distribution.golden +++ b/testdata/distribution.golden @@ -1,14 +1,11 @@ $ATOM distribution -+-----------------------+-------------+--------------+------------+------------+------------+------------+-------------+ | | TOTAL | DID NOT VOTE | YES | NO | NOWITHVETO | ABSTAIN | NOT STAKED | -+-----------------------+-------------+--------------+------------+------------+------------+------------+-------------+ +|-----------------------|-------------|--------------|------------|------------|------------|------------|-------------| | Distributed | 342,834,268 | 66,855,758 | 70,428,501 | 55,519,213 | 11,664,818 | 35,679,919 | 102,686,059 | | Percentage over total | | 20% | 21% | 16% | 3% | 10% | 30% | -+-----------------------+-------------+--------------+------------+------------+------------+------------+-------------+ + $ATONE distribution (ratio: x2.361, blend: 2.465, IcfSlash: 12,590,970 $ATOM) -+-----------------------+-------------+--------------+------------+-------------+------------+------------+-------------+ | | TOTAL | DID NOT VOTE | YES | NO | NOWITHVETO | ABSTAIN | NOT STAKED | -+-----------------------+-------------+--------------+------------+-------------+------------+------------+-------------+ +|-----------------------|-------------|--------------|------------|-------------|------------|------------|-------------| | Distributed | 809,415,611 | 158,897,406 | 63,746,761 | 213,404,392 | 47,911,135 | 86,287,988 | 239,167,930 | | Percentage over total | | 20% | 8% | 26% | 6% | 11% | 30% | -+-----------------------+-------------+--------------+------------+-------------+------------+------------+-------------+