diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-08-17 04:24:54 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-08-17 04:24:54 -0400 |
commit | 41df9d4e94bad6b89f0b4e4e535a6e30576b2879 (patch) | |
tree | ab4f3600e94234fce39141817529850fe2fcdce4 /src/views/txn_table.rs | |
parent | f04c18e3cac8b2f99a77cd2d202cd70e3ca9f32e (diff) | |
download | ynab-api-41df9d4e94bad6b89f0b4e4e535a6e30576b2879.tar.gz ynab-api-41df9d4e94bad6b89f0b4e4e535a6e30576b2879.zip |
display the account name too
Diffstat (limited to 'src/views/txn_table.rs')
-rw-r--r-- | src/views/txn_table.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/views/txn_table.rs b/src/views/txn_table.rs index 5b93829..7314337 100644 --- a/src/views/txn_table.rs +++ b/src/views/txn_table.rs @@ -4,6 +4,7 @@ use cursive::view::{Identifiable, ViewWrapper}; enum TxnColumn { Selected, Date, + Account, Payee, Amount, TotalAmount, @@ -52,6 +53,9 @@ impl cursive_table_view::TableViewItem<TxnColumn> } } TxnColumn::Date => self.date.clone(), + TxnColumn::Account => { + self.account.clone().unwrap_or_else(|| "".to_string()) + } TxnColumn::Payee => { self.payee.clone().unwrap_or_else(|| "".to_string()) } @@ -73,6 +77,7 @@ impl cursive_table_view::TableViewItem<TxnColumn> match column { TxnColumn::Selected => std::cmp::Ordering::Equal, TxnColumn::Date => self.date.cmp(&other.date), + TxnColumn::Account => self.account.cmp(&other.account), TxnColumn::Payee => self.payee.cmp(&other.payee), TxnColumn::Amount => self.amount.cmp(&other.amount), TxnColumn::TotalAmount => self.amount.cmp(&other.total_amount), @@ -107,6 +112,7 @@ fn txn_table( let mut table = cursive_table_view::TableView::new() .column(TxnColumn::Selected, "Sel", |c| c.width(3)) .column(TxnColumn::Date, "Date", |c| c.width(10)) + .column(TxnColumn::Account, "Account", |c| c.width(15)) .column(TxnColumn::Payee, "Payee", |c| c) .column(TxnColumn::Amount, "Amount", |c| { c.align(cursive::align::HAlign::Right).width(10) |