cmd: pretty printing
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
This commit is contained in:
parent
e84b32b615
commit
e926c48784
|
@ -58,7 +58,11 @@ func (c *getTransactionPoolCommand) RunE(_ *cobra.Command, _ []string) error {
|
|||
// nolint:forbidigo
|
||||
func (c *getTransactionPoolCommand) pretty(v *daemon.GetTransactionPoolResult) error {
|
||||
table := display.NewTable()
|
||||
table.AddRow("Spent Key Images:", len(v.SpentKeyImages))
|
||||
fmt.Println(table)
|
||||
fmt.Println()
|
||||
|
||||
table = display.NewTable()
|
||||
table.AddRow("AGE", "HASH", "FEE (µɱ)", "FEE (µɱ per kB)", "IN/OUT", "SIZE")
|
||||
|
||||
sort.Slice(v.Transactions, func(i, j int) bool {
|
||||
|
|
|
@ -2,6 +2,7 @@ package daemon
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
|
@ -59,11 +60,11 @@ func (c *getTransactionPoolStatsCommand) RunE(_ *cobra.Command, _ []string) erro
|
|||
func (c *getTransactionPoolStatsCommand) pretty(v *daemon.GetTransactionPoolStatsResult) {
|
||||
table := display.NewTable()
|
||||
|
||||
table.AddRow("Bytes Max:", v.PoolStats.BytesMax)
|
||||
table.AddRow("Bytes Med:", v.PoolStats.BytesMed)
|
||||
table.AddRow("Bytes Min:", v.PoolStats.BytesMin)
|
||||
table.AddRow("Bytes Total:", v.PoolStats.BytesTotal)
|
||||
table.AddRow("Fee Total:", v.PoolStats.FeeTotal)
|
||||
table.AddRow("Bytes Max:", humanize.Bytes(v.PoolStats.BytesMax))
|
||||
table.AddRow("Bytes Med:", humanize.Bytes(v.PoolStats.BytesMed))
|
||||
table.AddRow("Bytes Min:", humanize.Bytes(v.PoolStats.BytesMin))
|
||||
table.AddRow("Bytes Total:", humanize.Bytes(v.PoolStats.BytesTotal))
|
||||
table.AddRow("Fee Total:", display.PreciseXMR(v.PoolStats.FeeTotal))
|
||||
table.AddRow("Histogram 98pct:", v.PoolStats.Histo98Pc)
|
||||
table.AddRow("Txns in Pool for Longer than 10m:", v.PoolStats.Num10M)
|
||||
table.AddRow("Double Spends:", v.PoolStats.NumDoubleSpends)
|
||||
|
@ -74,6 +75,10 @@ func (c *getTransactionPoolStatsCommand) pretty(v *daemon.GetTransactionPoolStat
|
|||
|
||||
table.AddRow("")
|
||||
table.AddRow("BYTES", "TXNS")
|
||||
|
||||
sort.Slice(v.PoolStats.Histo, func(i, j int) bool {
|
||||
return v.PoolStats.Histo[i].Bytes < v.PoolStats.Histo[j].Bytes
|
||||
})
|
||||
for _, h := range v.PoolStats.Histo {
|
||||
if h.Bytes == 0 {
|
||||
continue
|
||||
|
|
Reference in a new issue