CLI: Allow missing pubkey in `--verbose` config output

This commit is contained in:
Trent Nelson 2021-01-21 23:58:34 -07:00 committed by Trent Nelson
parent 8f8d593457
commit 90e1778cd2
1 changed files with 5 additions and 1 deletions

View File

@ -1165,7 +1165,11 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
println_name_value("RPC URL:", &config.json_rpc_url);
println_name_value("Default Signer Path:", &config.keypair_path);
if config.keypair_path.starts_with("usb://") {
println_name_value("Pubkey:", &format!("{:?}", config.pubkey()?));
let pubkey = config
.pubkey()
.map(|pubkey| format!("{:?}", pubkey))
.unwrap_or_else(|_| "Unavailable".to_string());
println_name_value("Pubkey:", &pubkey);
}
println_name_value("Commitment:", &config.commitment.commitment.to_string());
}