Skip to content

Commit

Permalink
cli: Improve stake-history output readability
Browse files Browse the repository at this point in the history
  • Loading branch information
t-nelson authored and mergify[bot] committed Feb 1, 2021
1 parent 1c6f312 commit c8d83ae
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cli-output/src/cli_output.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use crate::{
display::{build_balance_message, format_labeled_address, writeln_name_value},
display::{
build_balance_message, build_balance_message_with_config, format_labeled_address,
writeln_name_value, BuildBalanceMessageConfig,
},
QuietDisplay, VerboseDisplay,
};
use chrono::{DateTime, NaiveDateTime, SecondsFormat, Utc};
Expand Down Expand Up @@ -902,14 +905,19 @@ impl fmt::Display for CliStakeHistory {
))
.bold()
)?;
let config = BuildBalanceMessageConfig {
use_lamports_unit: self.use_lamports_unit,
show_unit: false,
trim_trailing_zeros: false,
};
for entry in &self.entries {
writeln!(
f,
" {:>5} {:>20} {:>20} {:>20} {}",
entry.epoch,
build_balance_message(entry.effective_stake, self.use_lamports_unit, false),
build_balance_message(entry.activating_stake, self.use_lamports_unit, false),
build_balance_message(entry.deactivating_stake, self.use_lamports_unit, false),
build_balance_message_with_config(entry.effective_stake, &config),
build_balance_message_with_config(entry.activating_stake, &config),
build_balance_message_with_config(entry.deactivating_stake, &config),
if self.use_lamports_unit {
"lamports"
} else {
Expand Down

0 comments on commit c8d83ae

Please sign in to comment.