Merge pull request #5352 from filcloud/color-amount
add color for token amount
This commit is contained in:
commit
388c53e637
@ -222,7 +222,7 @@ func infoCmdAct(cctx *cli.Context) error {
|
|||||||
fmt.Printf(" PreCommit: %s\n", types.FIL(lockedFunds.PreCommitDeposits).Short())
|
fmt.Printf(" PreCommit: %s\n", types.FIL(lockedFunds.PreCommitDeposits).Short())
|
||||||
fmt.Printf(" Pledge: %s\n", types.FIL(lockedFunds.InitialPledgeRequirement).Short())
|
fmt.Printf(" Pledge: %s\n", types.FIL(lockedFunds.InitialPledgeRequirement).Short())
|
||||||
fmt.Printf(" Vesting: %s\n", types.FIL(lockedFunds.VestingFunds).Short())
|
fmt.Printf(" Vesting: %s\n", types.FIL(lockedFunds.VestingFunds).Short())
|
||||||
color.Green(" Available: %s", types.FIL(availBalance).Short())
|
colorTokenAmount(" Available: %s\n", availBalance)
|
||||||
|
|
||||||
mb, err := api.StateMarketBalance(ctx, maddr, types.EmptyTSK)
|
mb, err := api.StateMarketBalance(ctx, maddr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -232,7 +232,7 @@ func infoCmdAct(cctx *cli.Context) error {
|
|||||||
|
|
||||||
fmt.Printf("Market Balance: %s\n", types.FIL(mb.Escrow).Short())
|
fmt.Printf("Market Balance: %s\n", types.FIL(mb.Escrow).Short())
|
||||||
fmt.Printf(" Locked: %s\n", types.FIL(mb.Locked).Short())
|
fmt.Printf(" Locked: %s\n", types.FIL(mb.Locked).Short())
|
||||||
color.Green(" Available: %s\n", types.FIL(big.Sub(mb.Escrow, mb.Locked)).Short())
|
colorTokenAmount(" Available: %s\n", big.Sub(mb.Escrow, mb.Locked))
|
||||||
|
|
||||||
wb, err := api.WalletBalance(ctx, mi.Worker)
|
wb, err := api.WalletBalance(ctx, mi.Worker)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -253,7 +253,7 @@ func infoCmdAct(cctx *cli.Context) error {
|
|||||||
|
|
||||||
fmt.Printf(" Control: %s\n", types.FIL(cbsum).Short())
|
fmt.Printf(" Control: %s\n", types.FIL(cbsum).Short())
|
||||||
}
|
}
|
||||||
fmt.Printf("Total Spendable: %s\n", color.YellowString(types.FIL(spendable).Short()))
|
colorTokenAmount("Total Spendable: %s\n", spendable)
|
||||||
|
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
|
|
||||||
@ -359,3 +359,13 @@ func sectorsInfo(ctx context.Context, napi api.StorageMiner) error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func colorTokenAmount(format string, amount abi.TokenAmount) {
|
||||||
|
if amount.GreaterThan(big.Zero()) {
|
||||||
|
color.Green(format, types.FIL(amount).Short())
|
||||||
|
} else if amount.Equals(big.Zero()) {
|
||||||
|
color.Yellow(format, types.FIL(amount).Short())
|
||||||
|
} else {
|
||||||
|
color.Red(format, types.FIL(amount).Short())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user