Cli: output stake account credits-observed for verbose/json (#13923)

* Add credits_observed to verbose and json CliStakeStake prints

* Review comments
This commit is contained in:
Tyera Eulberg
2020-12-02 15:02:52 -07:00
committed by GitHub
parent 5bfe93e74c
commit a877f347f4
3 changed files with 35 additions and 5 deletions

View File

@ -168,6 +168,7 @@ pub fn parse_args<'a>(
let CliCommandInfo { command, signers } =
parse_command(&matches, &default_signer, &mut wallet_manager)?;
let verbose = matches.is_present("verbose");
let output_format = matches
.value_of("output_format")
.map(|value| match value {
@ -175,7 +176,11 @@ pub fn parse_args<'a>(
"json-compact" => OutputFormat::JsonCompact,
_ => unreachable!(),
})
.unwrap_or(OutputFormat::Display);
.unwrap_or(if verbose {
OutputFormat::DisplayVerbose
} else {
OutputFormat::Display
});
let commitment = matches
.subcommand_name()
@ -198,7 +203,7 @@ pub fn parse_args<'a>(
keypair_path: default_signer_path,
rpc_client: None,
rpc_timeout,
verbose: matches.is_present("verbose"),
verbose,
output_format,
commitment,
send_transaction_config: RpcSendTransactionConfig::default(),

View File

@ -1528,6 +1528,7 @@ pub fn build_stake_state(
CliStakeState {
stake_type: CliStakeType::Stake,
account_balance,
credits_observed: Some(stake.credits_observed),
delegated_stake: Some(stake.delegation.stake),
delegated_vote_account_address: if stake.delegation.voter_pubkey
!= Pubkey::default()
@ -1579,6 +1580,7 @@ pub fn build_stake_state(
CliStakeState {
stake_type: CliStakeType::Initialized,
account_balance,
credits_observed: Some(0),
authorized: Some(authorized.into()),
lockup,
use_lamports_unit,