Skip to content

Commit

Permalink
fix: print table in markdown format
Browse files Browse the repository at this point in the history
  • Loading branch information
tbruyelle committed Mar 20, 2024
1 parent 6f13b99 commit 21cbf8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 3 additions & 0 deletions distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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(),
Expand Down
9 changes: 3 additions & 6 deletions testdata/distribution.golden
Original file line number Diff line number Diff line change
@@ -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% |
+-----------------------+-------------+--------------+------------+-------------+------------+------------+-------------+

0 comments on commit 21cbf8c

Please sign in to comment.