Align the `solana validators` output columns for -ud,-ut, and -um
This commit is contained in:
parent
a57c7ba5df
commit
87b76aeeb0
|
@ -393,19 +393,19 @@ impl fmt::Display for CliValidators {
|
||||||
) -> fmt::Result {
|
) -> fmt::Result {
|
||||||
fn non_zero_or_dash(v: u64, max_v: u64) -> String {
|
fn non_zero_or_dash(v: u64, max_v: u64) -> String {
|
||||||
if v == 0 {
|
if v == 0 {
|
||||||
"- ".into()
|
" - ".into()
|
||||||
} else if v == max_v {
|
} else if v == max_v {
|
||||||
format!("{:>8} ( 0)", v)
|
format!("{:>9} ( 0)", v)
|
||||||
} else if v > max_v.saturating_sub(100) {
|
} else if v > max_v.saturating_sub(100) {
|
||||||
format!("{:>8} ({:>3})", v, -(max_v.saturating_sub(v) as isize))
|
format!("{:>9} ({:>3})", v, -(max_v.saturating_sub(v) as isize))
|
||||||
} else {
|
} else {
|
||||||
format!("{:>8} ", v)
|
format!("{:>9} ", v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writeln!(
|
writeln!(
|
||||||
f,
|
f,
|
||||||
"{} {:<44} {:<44} {:>3}% {:>14} {:>14} {:>7} {:>8} {:>7} {}",
|
"{} {:<44} {:<44} {:>3}% {:>14} {:>14} {:>7} {:>8} {:>7} {:>22} ({:.2}%)",
|
||||||
if validator.delinquent {
|
if validator.delinquent {
|
||||||
WARNING.to_string()
|
WARNING.to_string()
|
||||||
} else {
|
} else {
|
||||||
|
@ -419,19 +419,19 @@ impl fmt::Display for CliValidators {
|
||||||
if let Some(skip_rate) = validator.skip_rate {
|
if let Some(skip_rate) = validator.skip_rate {
|
||||||
format!("{:.2}%", skip_rate)
|
format!("{:.2}%", skip_rate)
|
||||||
} else {
|
} else {
|
||||||
"- ".to_string()
|
"- ".to_string()
|
||||||
},
|
},
|
||||||
validator.epoch_credits,
|
validator.epoch_credits,
|
||||||
validator.version,
|
validator.version,
|
||||||
if validator.activated_stake > 0 {
|
build_balance_message_with_config(
|
||||||
format!(
|
validator.activated_stake,
|
||||||
"{} ({:.2}%)",
|
&BuildBalanceMessageConfig {
|
||||||
build_balance_message(validator.activated_stake, use_lamports_unit, true),
|
use_lamports_unit,
|
||||||
100. * validator.activated_stake as f64 / total_active_stake as f64,
|
trim_trailing_zeros: false,
|
||||||
)
|
..BuildBalanceMessageConfig::default()
|
||||||
} else {
|
}
|
||||||
"-".into()
|
),
|
||||||
},
|
100. * validator.activated_stake as f64 / total_active_stake as f64,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,13 +441,13 @@ impl fmt::Display for CliValidators {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
let header = style(format!(
|
let header = style(format!(
|
||||||
"{:padding$} {:<44} {:<38} {} {} {} {} {} {} {}",
|
"{:padding$} {:<44} {:<38} {} {} {} {} {} {} {}",
|
||||||
" ",
|
" ",
|
||||||
"Identity",
|
"Identity",
|
||||||
"Vote Account",
|
"Vote Account",
|
||||||
"Commission",
|
"Commission",
|
||||||
"Last Vote ",
|
"Last Vote ",
|
||||||
"Root Slot ",
|
"Root Slot ",
|
||||||
"Skip Rate",
|
"Skip Rate",
|
||||||
"Credits",
|
"Credits",
|
||||||
"Version",
|
"Version",
|
||||||
|
|
Loading…
Reference in New Issue