* Add solana-cli-utils crate
* Use cli-utils in cli
* Move println fn to cli-output
* Use cli-config instead
(cherry picked from commit 8a73badf3d
)
Co-authored-by: Tyera Eulberg <tyera@solana.com>
This commit is contained in:
@ -22,6 +22,7 @@ serde_json = "1.0.79"
|
||||
solana-account-decoder = { path = "../account-decoder", version = "=1.10.9" }
|
||||
solana-clap-utils = { path = "../clap-utils", version = "=1.10.9" }
|
||||
solana-client = { path = "../client", version = "=1.10.9" }
|
||||
solana-cli-config = { path = "../cli-config", version = "=1.10.9" }
|
||||
solana-sdk = { path = "../sdk", version = "=1.10.9" }
|
||||
solana-transaction-status = { path = "../transaction-status", version = "=1.10.9" }
|
||||
solana-vote-program = { path = "../programs/vote", version = "=1.10.9" }
|
||||
|
@ -3,6 +3,7 @@ use {
|
||||
chrono::{DateTime, Local, NaiveDateTime, SecondsFormat, TimeZone, Utc},
|
||||
console::style,
|
||||
indicatif::{ProgressBar, ProgressStyle},
|
||||
solana_cli_config::SettingType,
|
||||
solana_sdk::{
|
||||
clock::UnixTimestamp,
|
||||
hash::Hash,
|
||||
@ -103,6 +104,21 @@ pub fn writeln_name_value(f: &mut dyn fmt::Write, name: &str, value: &str) -> fm
|
||||
writeln!(f, "{} {}", style(name).bold(), styled_value)
|
||||
}
|
||||
|
||||
pub fn println_name_value_or(name: &str, value: &str, setting_type: SettingType) {
|
||||
let description = match setting_type {
|
||||
SettingType::Explicit => "",
|
||||
SettingType::Computed => "(computed)",
|
||||
SettingType::SystemDefault => "(default)",
|
||||
};
|
||||
|
||||
println!(
|
||||
"{} {} {}",
|
||||
style(name).bold(),
|
||||
style(value),
|
||||
style(description).italic(),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn format_labeled_address(pubkey: &str, address_labels: &HashMap<String, String>) -> String {
|
||||
let label = address_labels.get(pubkey);
|
||||
match label {
|
||||
|
Reference in New Issue
Block a user