Files
solana/cli/src/display.rs
Michael Vines 5ffb6b874b cli: get command now shows default values instead of 'not set' (#5796)
* get command now shows default values instead of 'not set'

* Add default indicator
2019-09-05 10:14:23 -07:00

25 lines
622 B
Rust

use console::style;
// Pretty print a "name value"
pub fn println_name_value(name: &str, value: &str) {
let styled_value = if value == "" {
style("(not set)").italic()
} else {
style(value)
};
println!("{} {}", style(name).bold(), styled_value);
}
pub fn println_name_value_or(name: &str, value: &str, default_value: &str) {
if value == "" {
println!(
"{} {} {}",
style(name).bold(),
style(default_value),
style("(default)").italic()
);
} else {
println!("{} {}", style(name).bold(), style(value));
};
}