diff --git a/src/main.rs b/src/main.rs index 5c5ae0d..03bb212 100644 --- a/src/main.rs +++ b/src/main.rs @@ -171,7 +171,7 @@ async fn main() -> anyhow::Result<()> { }; println!("Transactions{} in the last 30 days:", accountstr); for t in transactions { - println!("{},{},{}", t.date, t.payee, t.amount); + println!("{},{},{}", t.date, t.payee, t.format_amount()); } Ok(()) diff --git a/src/transaction.rs b/src/transaction.rs index 7eae797..055ef56 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -32,7 +32,7 @@ impl Transaction { }) } - fn format_amount(&self) -> String { + pub fn format_amount(&self) -> String { let whole = self.amount / 10 / 100; let frac = if self.amount < 0 { -1 } else { 1 } * (self.amount / 10) % 100; format!("{}.{:02}", whole, frac)