Lines
92.31 %
Functions
50 %
Branches
100 %
//! `account balance` from the palette: the typed account is resolved against
//! the account options, then its balances print in the Console.
use cli_core::eval::escape_str;
use forms::FormValues;
use super::App;
use super::lookup::Goal;
use crate::command::{BALANCE_ACCOUNT, BALANCE_ARGS};
use crate::view::ViewId;
use crate::window::Origin;
impl App {
/// Print the balances of the account `input` names, by label or id.
pub fn show_account_balance(&mut self, input: &str) {
let mut values = FormValues::default();
values.set(BALANCE_ACCOUNT, input);
let origin = self.window_or_open(ViewId::Console);
self.start_lookup(Goal::Balance(origin), &BALANCE_ARGS, values);
}
pub(super) fn print_resolved_balance(&mut self, origin: Origin, resolved: &FormValues) {
let Some(console) = self.origin_window(origin) else {
return;
};
let id = resolved.text(BALANCE_ACCOUNT).unwrap_or_default();
self.submit_console_form(console, format!("(get-balances {})", escape_str(id)));
self.show_window_if_free(console);